Skip to content

Commit

Permalink
why is this not just the answer though
Browse files Browse the repository at this point in the history
  • Loading branch information
evanc5 committed Dec 7, 2021
1 parent 644aff9 commit b7a4084
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions Day07/Program.cs
Expand Up @@ -15,17 +15,26 @@ static void Main(string[] args)

static void Part1()
{
var input = File.ReadAllLines(@".\input.txt");
var rawInput = @"16,1,2,0,4,2,7,1,2,14";
var input = rawInput.Split(',');//File.ReadAllText(@".\input.txt").Split(',');
var sw = System.Diagnostics.Stopwatch.StartNew();

var positions = input.Select(int.Parse);
var average = (int)Math.Round(positions.Average(), 0);
var fuel = 0;
foreach (var pos in positions)
{
fuel += Math.Abs(pos - average);
}

sw.Stop();
Console.WriteLine($"Part 1: {fuel}");
System.Diagnostics.Debug.WriteLine($"Part 1: {sw.Elapsed}");
}

static void Part2()
{
var input = File.ReadAllLines(@".\input.txt");
var input = File.ReadAllText(@".\input.txt").Split(',');
var sw = System.Diagnostics.Stopwatch.StartNew();


Expand Down

0 comments on commit b7a4084

Please sign in to comment.