-
Notifications
You must be signed in to change notification settings - Fork 10
/
Day25.cs
25 lines (21 loc) · 843 Bytes
/
Day25.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using AdventOfCode.CSharp.Common;
using System;
using System.Numerics;
namespace AdventOfCode.CSharp.Y2015.Solvers;
public class Day25 : ISolver
{
public static void Solve(ReadOnlySpan<byte> input, Solution solution)
{
var reader = new SpanReader(input);
reader.SkipLength("To continue, please consult the code grid in the manual. Enter the code at row ".Length);
int row = reader.ReadPosIntUntil(',');
reader.SkipLength(" column ".Length);
int column = reader.ReadPosIntUntil('.');
int n = row + column - 1;
int diagEnd = n * (n + 1) / 2;
int repetitions = diagEnd - row;
BigInteger part1 = (BigInteger.ModPow(252533, repetitions, 33554393) * 20151125) % 33554393;
solution.SubmitPart1(part1);
solution.SubmitPart2(string.Empty);
}
}