ben
/
aoc
1
0
Fork 0

2022 day 1
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Ben Harris 2022-12-01 00:31:47 -05:00
parent 2de2266e18
commit 514a902829
4 changed files with 2271 additions and 4 deletions

View File

@ -5,7 +5,7 @@ namespace AOC.Test;
public class Test2022
{
[DataTestMethod]
[DataRow(typeof(Day01), "", "")]
[DataRow(typeof(Day01), "70509", "208567")]
public void CheckAllDays(Type dayType, string part1, string part2)
{
Common.CheckDay(dayType, part1, part2);

View File

@ -3,19 +3,35 @@
/// <summary>
/// Day 1: <see href="https://adventofcode.com/2022/day/1"/>
/// </summary>
public sealed class Day01 : Day
public sealed class Day01 : Day, IDay01
{
private readonly List<List<int>> _elfCalories = new();
public Day01() : base(2022, 1, "Day 1 Puzzle Name")
{
var elf = new List<int>();
foreach (var line in Input)
{
if (string.IsNullOrWhiteSpace(line))
{
_elfCalories.Add(elf);
elf = new();
}
else
elf.Add(int.Parse(line));
}
if (elf.Any()) _elfCalories.Add(elf);
}
public override object Part1()
{
return "";
return _elfCalories.OrderByDescending(e => e.Sum()).First().Sum();
}
public override object Part2()
{
return "";
return _elfCalories.OrderByDescending(e => e.Sum()).Take(3).Sum(e => e.Sum());
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,14 @@
1000
2000
3000
4000
5000
6000
7000
8000
9000
10000