Improved the program

master
gnomerd 5 years ago
parent 8401ff8285
commit e542c79631
  1. 34
      2019/Day1/Part1/Program.cs
  2. BIN
      2019/Day1/Part1/bin/Debug/netcoreapp2.2/1.dll
  3. BIN
      2019/Day1/Part1/bin/Debug/netcoreapp2.2/1.pdb
  4. 2
      2019/Day1/Part1/obj/1.csproj.nuget.cache
  5. 10
      2019/Day1/Part1/obj/1.csproj.nuget.dgspec.json
  6. BIN
      2019/Day1/Part1/obj/Debug/netcoreapp2.2/1.assets.cache
  7. 11
      2019/Day1/Part1/obj/Debug/netcoreapp2.2/1.csproj.FileListAbsolute.txt
  8. BIN
      2019/Day1/Part1/obj/Debug/netcoreapp2.2/1.csprojAssemblyReference.cache
  9. BIN
      2019/Day1/Part1/obj/Debug/netcoreapp2.2/1.dll
  10. BIN
      2019/Day1/Part1/obj/Debug/netcoreapp2.2/1.pdb
  11. 6
      2019/Day1/Part1/obj/project.assets.json

@ -1,24 +1,36 @@
using System;
using System.IO;
namespace _1
{
class Program {
static void Main(string[] args) {
string input = File.ReadAllText(@"../../input.txt");
namespace _1 {
string[] inputs = input.Split( Environment.NewLine, StringSplitOptions.None );
public class Part1 {
public int[] GetFuelModules( string[] inputs ) {
int[] output = new int[100];
double input_;
int sum = 0;
for ( int i = 0; i < inputs.Length; i++ ) {
Console.WriteLine( inputs[i] );
input_ = Convert.ToDouble(inputs[i]);
output[i] = (int)Math.Floor( input_/3 ) - 2;
output[i] = (int)Math.Floor( input_/3 ) - 2; // do the fuel calc
Console.WriteLine(output[i]);
sum += output[i];
}
Console.WriteLine("Sum: " + sum.ToString() );
return output;
}
}
class Program {
static void Main(string[] args) {
string input = File.ReadAllText(@"../../input.txt"); // get the input
string[] inputs = input.Split( Environment.NewLine, StringSplitOptions.None );
int[] modules = new int[100];
Part1 prt1 = new Part1();
modules = prt1.GetFuelModules( inputs ); // get the fuel for the mass'es
int sum = 0;
for( int i = 0; i < modules.Length; i++ ) { sum += modules[i]; } // add all of the fuel
Console.WriteLine("Sum: " + sum.ToString() ); //output the answer
}
}
}

@ -1,5 +1,5 @@
{
"version": 1,
"dgSpecHash": "hlP5W6uik5AKYzYaqydZAtN7NpaAPiJYwaOzkFjRdruhszdT5w4zqaLwJjvuIEXxtFqMdTLHu3+MLKgFJvjKbQ==",
"dgSpecHash": "a9cmKxPtaVLJgBbLvCLdAzqO87TswSkxSOVeVFcLneixlXuOncEDf4jBVHiIPoDJ3jcjFaFRaIcS7j0f1n28xQ==",
"success": true
}

@ -1,17 +1,17 @@
{
"format": 1,
"restore": {
"C:\\EliasPrograms\\adventofcode\\2019\\1\\1.csproj": {}
"C:\\EliasPrograms\\adventofcode\\2019\\Day1\\Part1\\1.csproj": {}
},
"projects": {
"C:\\EliasPrograms\\adventofcode\\2019\\1\\1.csproj": {
"C:\\EliasPrograms\\adventofcode\\2019\\Day1\\Part1\\1.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "C:\\EliasPrograms\\adventofcode\\2019\\1\\1.csproj",
"projectUniqueName": "C:\\EliasPrograms\\adventofcode\\2019\\Day1\\Part1\\1.csproj",
"projectName": "1",
"projectPath": "C:\\EliasPrograms\\adventofcode\\2019\\1\\1.csproj",
"projectPath": "C:\\EliasPrograms\\adventofcode\\2019\\Day1\\Part1\\1.csproj",
"packagesPath": "C:\\Users\\elias.almqvist\\.nuget\\packages\\",
"outputPath": "C:\\EliasPrograms\\adventofcode\\2019\\1\\obj\\",
"outputPath": "C:\\EliasPrograms\\adventofcode\\2019\\Day1\\Part1\\obj\\",
"projectStyle": "PackageReference",
"fallbackFolders": [
"C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder"

@ -9,3 +9,14 @@ C:\EliasPrograms\adventofcode\2019\1\obj\Debug\netcoreapp2.2\1.AssemblyInfoInput
C:\EliasPrograms\adventofcode\2019\1\obj\Debug\netcoreapp2.2\1.AssemblyInfo.cs
C:\EliasPrograms\adventofcode\2019\1\obj\Debug\netcoreapp2.2\1.dll
C:\EliasPrograms\adventofcode\2019\1\obj\Debug\netcoreapp2.2\1.pdb
C:\EliasPrograms\adventofcode\2019\Day1\Part1\bin\Debug\netcoreapp2.2\1.deps.json
C:\EliasPrograms\adventofcode\2019\Day1\Part1\bin\Debug\netcoreapp2.2\1.runtimeconfig.json
C:\EliasPrograms\adventofcode\2019\Day1\Part1\bin\Debug\netcoreapp2.2\1.runtimeconfig.dev.json
C:\EliasPrograms\adventofcode\2019\Day1\Part1\bin\Debug\netcoreapp2.2\1.dll
C:\EliasPrograms\adventofcode\2019\Day1\Part1\bin\Debug\netcoreapp2.2\1.pdb
C:\EliasPrograms\adventofcode\2019\Day1\Part1\obj\Debug\netcoreapp2.2\1.csprojAssemblyReference.cache
C:\EliasPrograms\adventofcode\2019\Day1\Part1\obj\Debug\netcoreapp2.2\1.csproj.CoreCompileInputs.cache
C:\EliasPrograms\adventofcode\2019\Day1\Part1\obj\Debug\netcoreapp2.2\1.AssemblyInfoInputs.cache
C:\EliasPrograms\adventofcode\2019\Day1\Part1\obj\Debug\netcoreapp2.2\1.AssemblyInfo.cs
C:\EliasPrograms\adventofcode\2019\Day1\Part1\obj\Debug\netcoreapp2.2\1.dll
C:\EliasPrograms\adventofcode\2019\Day1\Part1\obj\Debug\netcoreapp2.2\1.pdb

@ -692,11 +692,11 @@
"project": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "C:\\EliasPrograms\\adventofcode\\2019\\1\\1.csproj",
"projectUniqueName": "C:\\EliasPrograms\\adventofcode\\2019\\Day1\\Part1\\1.csproj",
"projectName": "1",
"projectPath": "C:\\EliasPrograms\\adventofcode\\2019\\1\\1.csproj",
"projectPath": "C:\\EliasPrograms\\adventofcode\\2019\\Day1\\Part1\\1.csproj",
"packagesPath": "C:\\Users\\elias.almqvist\\.nuget\\packages\\",
"outputPath": "C:\\EliasPrograms\\adventofcode\\2019\\1\\obj\\",
"outputPath": "C:\\EliasPrograms\\adventofcode\\2019\\Day1\\Part1\\obj\\",
"projectStyle": "PackageReference",
"fallbackFolders": [
"C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder"

Loading…
Cancel
Save