commit d80a28341221572c97007e2743aa0dabf5585985
parent 530b2d3dbb4c7a939734c34e9bb1174619d74568
Author: Martin Ashby <martin@ashbysoft.com>
Date: Thu, 2 Jan 2025 20:21:31 +0000
Day 13 part2, just a small tweak to pt1
Diffstat:
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/src/main/java/day13_pt1.java b/src/main/java/day13_pt1.java
@@ -50,8 +50,13 @@ class day13_pt1 {
var zm = Z.matcher(zline);
if (!zm.matches()) throw new RuntimeException("line doesn't match [%s]".formatted(zline));
- var zx = Long.parseLong(zm.group(1));
- var zy = Long.parseLong(zm.group(2));
+
+ // PART2
+ //var zx = Long.parseLong(zm.group(1));
+ //var zy = Long.parseLong(zm.group(2));
+ var zx = Long.parseLong(zm.group(1)) + 10000000000000l;
+ var zy = Long.parseLong(zm.group(2)) + 10000000000000l;
+
//System.out.printf("A * %d + B * %d = %d\n", ax, bx, zx);
//System.out.printf("A * %d + B * %d = %d\n", ay, by, zy);
// Solve for A
@@ -65,9 +70,10 @@ class day13_pt1 {
}
var a = c1 / c2;
//System.out.printf("A = %d\n", a);
- if (a > 100) {
+ //if (a > 100) { // PART2
//System.out.println("A is too big, skipping");
- }
+ //continue;
+ //}
res += (3 * a);
}
// Solve for B
@@ -80,10 +86,10 @@ class day13_pt1 {
}
var b = c1 / c2;
//System.out.printf("B = %d\n", b);
- if (b > 100) {
+ //if (b > 100) { // PART2
//System.out.println("B is too big, skipping");
- continue;
- }
+ //continue;
+ //}
res += b;
}
//System.out.println("");