Skip to content

Commit d0df143

Browse files
committed
day 24
1 parent c67ec81 commit d0df143

File tree

1 file changed

+22
-47
lines changed

1 file changed

+22
-47
lines changed

2021/Day24/Solution.cs

Lines changed: 22 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -13,35 +13,10 @@ class Solution : Solver {
1313

1414
public object PartOne(string input) {
1515
var lines = input.Split('\n');
16-
// var k = 0;
17-
// var code0 = "47963957899999";
18-
// Console.WriteLine(Run2("97989681", 0, lines));
19-
Console.WriteLine(Run("96979989681495", 0, lines));
20-
21-
// var code0 = "99999999999999";
22-
// for (var i = BigInteger.Parse(code0); i >= 0; i--) {
23-
// var code = string.Join("", i.ToString());
24-
// if (code.Contains('0')) {
25-
// continue;
26-
// }
27-
// k++;
28-
29-
// try {
30-
// var z = Run2(code, 0, lines);
31-
// if (z == 0) {
32-
// Console.WriteLine(code);
33-
// }
34-
// if (k % 10000 == 0) {
35-
// Console.WriteLine(code);
36-
// }
37-
// } catch (OverflowException) {
38-
39-
// }
40-
// }
16+
Console.WriteLine(Run("96979989692495", 0, lines));
4117
return 0;
4218
}
4319

44-
4520
BigInteger Run2(string input, BigInteger z, string[] lines) {
4621
int from = 0;
4722
var ich = 0;
@@ -58,29 +33,29 @@ BigInteger step(int iblock, BigInteger z, BigInteger S, BigInteger T, BigInteger
5833
z = z / S;
5934
return z * (25 * x + 1) + (w + U) * x;
6035
}
61-
var zOrig = z;
62-
z = step(0, z, 1, 12, 1); // 9
63-
z = step(1, z, 1, 13, 9); // 6
64-
65-
z = step(2, z, 1, 12, 11); // 9
66-
z = step(3, z, 26, -13, 6); // 7
67-
68-
z = step(4, z, 1, 11, 6); // 9
69-
z = step(5, z, 1, 15, 13); // 9
70-
z = step(6, z, 26, -14, 13); // 8
71-
72-
z = step(7, z, 1, 12, 5); // 9
73-
z = step(8, z, 26, -8, 7); // 6
7436

75-
z = step(9, z, 1, 14, 2); // 8
76-
z = step(10, z, 26, -9, 10); // 1
77-
z = step(11, z, 26, -11, 14); // 4
78-
z = step(12, z, 26, -6, 7); // 9
79-
z = step(13, z, 26, -5, 1); // 5
37+
var zOrig = z;
38+
z = step(0, z, 1, 12, 1); // 9 ------------\
39+
z = step(1, z, 1, 13, 9); // 6 -------\ |
40+
// | |
41+
z = step(2, z, 1, 12, 11); // 9 | |
42+
z = step(3, z, 26, -13, 6); // 7 | |
43+
// | |
44+
z = step(4, z, 1, 11, 6); // 9 ----\ | |
45+
// | | |
46+
z = step(5, z, 1, 15, 13); // 9 | | |
47+
z = step(6, z, 26, -14, 13); // 8 | | |
48+
// | | |
49+
z = step(7, z, 1, 12, 5); // 9 | | |
50+
z = step(8, z, 26, -8, 7); // 6 | | |
51+
// | | |
52+
z = step(9, z, 1, 14, 2); // 9 | | |
53+
z = step(10, z, 26, -9, 10); // 2 | | |
54+
// | | |
55+
z = step(11, z, 26, -11, 14); // 4 <----/ | |
56+
z = step(12, z, 26, -6, 7); // 9 <--------/ |
57+
z = step(13, z, 26, -5, 1); // 5 <-------------/
8058

81-
// if (z != Run(input, (0, 0, zOrig, 0), lines)) {
82-
// throw new Exception("coki");
83-
// }
8459
return z;
8560
}
8661

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy