-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathDay25.cs
More file actions
28 lines (23 loc) · 682 Bytes
/
Day25.cs
File metadata and controls
28 lines (23 loc) · 682 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
26
27
28
using System;
using System.Numerics;
using AdventOfCode.CSharp.Common;
namespace AdventOfCode.CSharp.Y2020.Solvers;
public class Day25 : ISolver
{
public static void Solve(ReadOnlySpan<byte> input, Solution solution)
{
var reader = new SpanReader(input);
var key1 = reader.ReadPosIntUntil('\n');
var key2 = reader.ReadPosIntUntil('\n');
var n = 1;
var loopSize = 0;
while (n != key1)
{
n = (7 * n) % 20201227;
loopSize++;
}
var part1 = BigInteger.ModPow(key2, loopSize, 20201227);
solution.SubmitPart1(part1);
solution.SubmitPart2(string.Empty);
}
}