-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathDay25.cs
More file actions
25 lines (21 loc) · 836 Bytes
/
Day25.cs
File metadata and controls
25 lines (21 loc) · 836 Bytes
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);
var row = reader.ReadPosIntUntil(',');
reader.SkipLength(" column ".Length);
var column = reader.ReadPosIntUntil('.');
var n = row + column - 1;
var diagEnd = n * (n + 1) / 2;
var repetitions = diagEnd - row;
var part1 = (BigInteger.ModPow(252533, repetitions, 33554393) * 20151125) % 33554393;
solution.SubmitPart1(part1);
solution.SubmitPart2(string.Empty);
}
}