first commit
This commit is contained in:
153
ProblemOne/Program.cs
Normal file
153
ProblemOne/Program.cs
Normal file
@@ -0,0 +1,153 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProblemOne
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Console.WriteLine(GetTotalFuelRequiredPartOne());
|
||||
Console.WriteLine(GetTotalFuelRequiredPartTwo());
|
||||
Console.ReadLine();
|
||||
}
|
||||
|
||||
static int GetTotalFuelRequiredPartTwo()
|
||||
{
|
||||
var totalFuelRequired = 0;
|
||||
foreach (var massInput in MassInputs)
|
||||
{
|
||||
var fuelRequired = massInput;
|
||||
do
|
||||
{
|
||||
fuelRequired = GetFuelRequiredPartOne(fuelRequired);
|
||||
totalFuelRequired += fuelRequired;
|
||||
}
|
||||
while (GetFuelRequiredPartOne(fuelRequired) > 0);
|
||||
}
|
||||
|
||||
return totalFuelRequired;
|
||||
}
|
||||
|
||||
static int GetTotalFuelRequiredPartOne()
|
||||
{
|
||||
var totalFuelRequired = 0;
|
||||
foreach (var massInput in MassInputs)
|
||||
totalFuelRequired += GetFuelRequiredPartOne(massInput);
|
||||
|
||||
return totalFuelRequired;
|
||||
}
|
||||
|
||||
static int GetFuelRequiredPartOne(int massInput)
|
||||
{
|
||||
return (int)(Math.Floor(massInput / 3.0M) - 2.0M);
|
||||
}
|
||||
|
||||
static List<int> MassInputs = new List<int>()
|
||||
{
|
||||
92349,
|
||||
57040,
|
||||
64079,
|
||||
121555,
|
||||
143735,
|
||||
64642,
|
||||
104858,
|
||||
144446,
|
||||
88871,
|
||||
62338,
|
||||
113424,
|
||||
59960,
|
||||
53999,
|
||||
86867,
|
||||
67224,
|
||||
124130,
|
||||
108921,
|
||||
130492,
|
||||
120361,
|
||||
74426,
|
||||
70397,
|
||||
88106,
|
||||
125442,
|
||||
74237,
|
||||
137818,
|
||||
66633,
|
||||
71756,
|
||||
143276,
|
||||
143456,
|
||||
135698,
|
||||
121124,
|
||||
67739,
|
||||
112861,
|
||||
78572,
|
||||
73565,
|
||||
111899,
|
||||
57543,
|
||||
130314,
|
||||
121605,
|
||||
121426,
|
||||
117143,
|
||||
129957,
|
||||
98042,
|
||||
104760,
|
||||
144846,
|
||||
131238,
|
||||
101076,
|
||||
53328,
|
||||
83592,
|
||||
104077,
|
||||
101952,
|
||||
54137,
|
||||
115363,
|
||||
60556,
|
||||
133086,
|
||||
113361,
|
||||
117829,
|
||||
75003,
|
||||
93729,
|
||||
140022,
|
||||
126219,
|
||||
59907,
|
||||
140589,
|
||||
91812,
|
||||
50485,
|
||||
56232,
|
||||
92858,
|
||||
106820,
|
||||
123423,
|
||||
98553,
|
||||
135315,
|
||||
95583,
|
||||
72278,
|
||||
98702,
|
||||
55709,
|
||||
146773,
|
||||
89719,
|
||||
134752,
|
||||
79562,
|
||||
70455,
|
||||
88468,
|
||||
139824,
|
||||
138646,
|
||||
117516,
|
||||
123267,
|
||||
113754,
|
||||
120353,
|
||||
139145,
|
||||
53219,
|
||||
63053,
|
||||
131434,
|
||||
91705,
|
||||
53650,
|
||||
145234,
|
||||
78461,
|
||||
119587,
|
||||
108976,
|
||||
113613,
|
||||
121790,
|
||||
120366
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user