2015 day 25
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
523407067d
commit
546dc6029a
|
@ -28,6 +28,7 @@ public class Test2015
|
||||||
[DataRow(typeof(Day20), "665280", "705600")]
|
[DataRow(typeof(Day20), "665280", "705600")]
|
||||||
[DataRow(typeof(Day21), "78", "148")]
|
[DataRow(typeof(Day21), "78", "148")]
|
||||||
[DataRow(typeof(Day23), "255", "334")]
|
[DataRow(typeof(Day23), "255", "334")]
|
||||||
|
[DataRow(typeof(Day25), "9132360", "")]
|
||||||
public void CheckAllDays(Type dayType, string part1, string part2)
|
public void CheckAllDays(Type dayType, string part1, string part2)
|
||||||
{
|
{
|
||||||
Common.CheckDay(dayType, part1, part2);
|
Common.CheckDay(dayType, part1, part2);
|
||||||
|
|
|
@ -3,13 +3,28 @@ namespace AOC2015;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Day 25: <a href="https://adventofcode.com/2015/day/25"/>
|
/// Day 25: <a href="https://adventofcode.com/2015/day/25"/>
|
||||||
/// </summary>
|
/// </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()
|
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() => "";
|
public override object Part2() => "";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue