ben
/
aoc
1
0
Fork 0

2015 day 25
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Ben Harris 2023-11-20 15:03:19 -05:00
parent 523407067d
commit 546dc6029a
2 changed files with 18 additions and 2 deletions

View File

@ -28,6 +28,7 @@ public class Test2015
[DataRow(typeof(Day20), "665280", "705600")]
[DataRow(typeof(Day21), "78", "148")]
[DataRow(typeof(Day23), "255", "334")]
[DataRow(typeof(Day25), "9132360", "")]
public void CheckAllDays(Type dayType, string part1, string part2)
{
Common.CheckDay(dayType, part1, part2);

View File

@ -3,13 +3,28 @@ namespace AOC2015;
/// <summary>
/// Day 25: <a href="https://adventofcode.com/2015/day/25"/>
/// </summary>
public sealed class Day25() : Day(2015, 25, "Let It Snow")
public sealed partial class Day25() : Day(2015, 25, "Let It Snow")
{
[GeneratedRegex(@"\d+")]
private static partial Regex NumbersRegex();
private int _row, _col;
public override void ProcessInput()
{
var s = NumbersRegex().Matches(Input.First()).Select(m => int.Parse(m.Value)).ToList();
_row = s[0];
_col = s[1];
}
public override object Part1() => "";
public override object Part1()
{
var index = _row + _col - 2;
index = index * (index + 1) / 2 + _col - 1;
return Enumerable.Range(0, index)
.Aggregate(20151125ul, (current, _) => current * 252533 % 33554393);
}
public override object Part2() => "";
}