aoc2024

Advent of Code 2024
Log | Files | Refs | README

commit 530b2d3dbb4c7a939734c34e9bb1174619d74568
parent e1652e565d5220b01a736e8722b3b5e8d8ba342c
Author: Martin Ashby <martin@ashbysoft.com>
Date:   Thu,  2 Jan 2025 20:17:52 +0000

Day 13 pt1

Diffstat:
Aday13.txt | 1279+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aday13_sample.txt | 15+++++++++++++++
Asrc/main/java/day13_pt1.java | 93+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 1387 insertions(+), 0 deletions(-)

diff --git a/day13.txt b/day13.txt @@ -0,0 +1,1279 @@ +Button A: X+40, Y+38 +Button B: X+21, Y+84 +Prize: X=4245, Y=5634 + +Button A: X+19, Y+11 +Button B: X+37, Y+98 +Prize: X=3246, Y=6474 + +Button A: X+12, Y+38 +Button B: X+44, Y+28 +Prize: X=812, Y=12604 + +Button A: X+29, Y+13 +Button B: X+39, Y+72 +Prize: X=2243, Y=14090 + +Button A: X+96, Y+46 +Button B: X+42, Y+79 +Prize: X=12408, Y=11362 + +Button A: X+65, Y+27 +Button B: X+12, Y+51 +Prize: X=8809, Y=6422 + +Button A: X+11, Y+91 +Button B: X+66, Y+82 +Prize: X=5830, Y=9254 + +Button A: X+57, Y+13 +Button B: X+16, Y+67 +Prize: X=5153, Y=5103 + +Button A: X+11, Y+70 +Button B: X+83, Y+20 +Prize: X=14755, Y=16410 + +Button A: X+51, Y+84 +Button B: X+66, Y+23 +Prize: X=5607, Y=2550 + +Button A: X+14, Y+59 +Button B: X+78, Y+20 +Prize: X=14912, Y=3331 + +Button A: X+56, Y+21 +Button B: X+25, Y+58 +Prize: X=4872, Y=6778 + +Button A: X+75, Y+40 +Button B: X+22, Y+40 +Prize: X=7732, Y=5000 + +Button A: X+15, Y+41 +Button B: X+82, Y+51 +Prize: X=5669, Y=14331 + +Button A: X+98, Y+34 +Button B: X+75, Y+89 +Prize: X=10561, Y=9899 + +Button A: X+12, Y+49 +Button B: X+43, Y+13 +Prize: X=14958, Y=12094 + +Button A: X+18, Y+52 +Button B: X+48, Y+21 +Prize: X=12410, Y=2602 + +Button A: X+77, Y+17 +Button B: X+16, Y+60 +Prize: X=7055, Y=2247 + +Button A: X+13, Y+40 +Button B: X+43, Y+24 +Prize: X=4112, Y=9984 + +Button A: X+37, Y+75 +Button B: X+68, Y+37 +Prize: X=8408, Y=7867 + +Button A: X+13, Y+42 +Button B: X+70, Y+38 +Prize: X=7381, Y=302 + +Button A: X+28, Y+56 +Button B: X+53, Y+11 +Prize: X=8944, Y=14348 + +Button A: X+91, Y+43 +Button B: X+12, Y+47 +Prize: X=9012, Y=5209 + +Button A: X+13, Y+78 +Button B: X+70, Y+46 +Prize: X=5613, Y=8620 + +Button A: X+17, Y+42 +Button B: X+89, Y+55 +Prize: X=4722, Y=3422 + +Button A: X+85, Y+48 +Button B: X+28, Y+73 +Prize: X=8605, Y=6289 + +Button A: X+13, Y+38 +Button B: X+53, Y+36 +Prize: X=12197, Y=19510 + +Button A: X+99, Y+58 +Button B: X+11, Y+89 +Prize: X=3630, Y=3365 + +Button A: X+49, Y+19 +Button B: X+13, Y+52 +Prize: X=16162, Y=11677 + +Button A: X+23, Y+47 +Button B: X+53, Y+22 +Prize: X=15642, Y=1633 + +Button A: X+28, Y+70 +Button B: X+68, Y+21 +Prize: X=6924, Y=3304 + +Button A: X+14, Y+47 +Button B: X+87, Y+23 +Prize: X=3695, Y=2449 + +Button A: X+11, Y+27 +Button B: X+69, Y+43 +Prize: X=17286, Y=19692 + +Button A: X+27, Y+73 +Button B: X+84, Y+30 +Prize: X=4794, Y=6654 + +Button A: X+42, Y+82 +Button B: X+92, Y+39 +Prize: X=9358, Y=6599 + +Button A: X+21, Y+96 +Button B: X+45, Y+38 +Prize: X=3318, Y=3428 + +Button A: X+19, Y+37 +Button B: X+71, Y+42 +Prize: X=5997, Y=5325 + +Button A: X+61, Y+18 +Button B: X+30, Y+70 +Prize: X=8745, Y=8360 + +Button A: X+55, Y+87 +Button B: X+94, Y+44 +Prize: X=3924, Y=4532 + +Button A: X+24, Y+99 +Button B: X+33, Y+19 +Prize: X=2670, Y=3752 + +Button A: X+62, Y+37 +Button B: X+11, Y+30 +Prize: X=8816, Y=16214 + +Button A: X+15, Y+34 +Button B: X+49, Y+12 +Prize: X=3691, Y=2026 + +Button A: X+12, Y+41 +Button B: X+57, Y+36 +Prize: X=5282, Y=11476 + +Button A: X+72, Y+28 +Button B: X+16, Y+45 +Prize: X=14752, Y=5614 + +Button A: X+19, Y+41 +Button B: X+51, Y+30 +Prize: X=16527, Y=10945 + +Button A: X+20, Y+45 +Button B: X+94, Y+13 +Prize: X=8348, Y=4491 + +Button A: X+69, Y+28 +Button B: X+36, Y+86 +Prize: X=7974, Y=10018 + +Button A: X+13, Y+53 +Button B: X+65, Y+20 +Prize: X=9610, Y=7395 + +Button A: X+65, Y+16 +Button B: X+31, Y+51 +Prize: X=7167, Y=3152 + +Button A: X+65, Y+36 +Button B: X+11, Y+31 +Prize: X=1895, Y=2544 + +Button A: X+56, Y+30 +Button B: X+27, Y+52 +Prize: X=15207, Y=17592 + +Button A: X+83, Y+25 +Button B: X+23, Y+60 +Prize: X=2631, Y=2650 + +Button A: X+66, Y+37 +Button B: X+31, Y+65 +Prize: X=6096, Y=5989 + +Button A: X+42, Y+15 +Button B: X+23, Y+57 +Prize: X=11824, Y=15227 + +Button A: X+67, Y+56 +Button B: X+17, Y+64 +Prize: X=6571, Y=9824 + +Button A: X+14, Y+44 +Button B: X+51, Y+17 +Prize: X=9714, Y=2462 + +Button A: X+36, Y+89 +Button B: X+66, Y+42 +Prize: X=3342, Y=6687 + +Button A: X+99, Y+67 +Button B: X+45, Y+97 +Prize: X=11259, Y=12411 + +Button A: X+14, Y+49 +Button B: X+67, Y+34 +Prize: X=6905, Y=15896 + +Button A: X+48, Y+11 +Button B: X+40, Y+88 +Prize: X=3104, Y=2288 + +Button A: X+38, Y+12 +Button B: X+26, Y+59 +Prize: X=19188, Y=1197 + +Button A: X+81, Y+78 +Button B: X+59, Y+11 +Prize: X=8027, Y=7409 + +Button A: X+32, Y+86 +Button B: X+80, Y+53 +Prize: X=8656, Y=11113 + +Button A: X+71, Y+33 +Button B: X+28, Y+85 +Prize: X=2196, Y=4476 + +Button A: X+48, Y+87 +Button B: X+68, Y+13 +Prize: X=4844, Y=4039 + +Button A: X+15, Y+72 +Button B: X+67, Y+14 +Prize: X=1220, Y=17648 + +Button A: X+25, Y+67 +Button B: X+61, Y+15 +Prize: X=17544, Y=1752 + +Button A: X+82, Y+15 +Button B: X+54, Y+81 +Prize: X=10520, Y=5196 + +Button A: X+78, Y+31 +Button B: X+14, Y+61 +Prize: X=8064, Y=5150 + +Button A: X+42, Y+90 +Button B: X+52, Y+23 +Prize: X=6212, Y=8890 + +Button A: X+95, Y+75 +Button B: X+12, Y+91 +Prize: X=9924, Y=13297 + +Button A: X+12, Y+51 +Button B: X+83, Y+45 +Prize: X=15950, Y=18296 + +Button A: X+46, Y+16 +Button B: X+27, Y+60 +Prize: X=6025, Y=13612 + +Button A: X+32, Y+45 +Button B: X+32, Y+14 +Prize: X=1888, Y=1477 + +Button A: X+42, Y+54 +Button B: X+69, Y+21 +Prize: X=3942, Y=3714 + +Button A: X+72, Y+39 +Button B: X+15, Y+45 +Prize: X=1362, Y=1254 + +Button A: X+28, Y+88 +Button B: X+57, Y+29 +Prize: X=4401, Y=8877 + +Button A: X+69, Y+11 +Button B: X+35, Y+87 +Prize: X=3006, Y=1212 + +Button A: X+57, Y+79 +Button B: X+91, Y+32 +Prize: X=5923, Y=5856 + +Button A: X+26, Y+60 +Button B: X+66, Y+33 +Prize: X=5128, Y=2216 + +Button A: X+14, Y+79 +Button B: X+72, Y+26 +Prize: X=5660, Y=4558 + +Button A: X+83, Y+40 +Button B: X+33, Y+67 +Prize: X=4671, Y=4857 + +Button A: X+50, Y+16 +Button B: X+20, Y+70 +Prize: X=8900, Y=18512 + +Button A: X+23, Y+11 +Button B: X+42, Y+68 +Prize: X=17224, Y=8282 + +Button A: X+18, Y+93 +Button B: X+57, Y+33 +Prize: X=882, Y=2988 + +Button A: X+11, Y+60 +Button B: X+47, Y+21 +Prize: X=6017, Y=10736 + +Button A: X+27, Y+76 +Button B: X+51, Y+12 +Prize: X=5903, Y=6940 + +Button A: X+24, Y+54 +Button B: X+35, Y+16 +Prize: X=1232, Y=10490 + +Button A: X+91, Y+13 +Button B: X+53, Y+65 +Prize: X=7614, Y=6084 + +Button A: X+96, Y+52 +Button B: X+49, Y+92 +Prize: X=1846, Y=2440 + +Button A: X+12, Y+95 +Button B: X+30, Y+12 +Prize: X=1266, Y=6189 + +Button A: X+22, Y+78 +Button B: X+75, Y+44 +Prize: X=6451, Y=7560 + +Button A: X+11, Y+37 +Button B: X+94, Y+41 +Prize: X=6319, Y=3368 + +Button A: X+24, Y+41 +Button B: X+49, Y+24 +Prize: X=2649, Y=9232 + +Button A: X+13, Y+56 +Button B: X+47, Y+12 +Prize: X=19749, Y=9960 + +Button A: X+55, Y+18 +Button B: X+23, Y+74 +Prize: X=10144, Y=3912 + +Button A: X+43, Y+18 +Button B: X+21, Y+35 +Prize: X=954, Y=13100 + +Button A: X+66, Y+83 +Button B: X+78, Y+18 +Prize: X=6546, Y=5509 + +Button A: X+78, Y+23 +Button B: X+12, Y+56 +Prize: X=14924, Y=228 + +Button A: X+20, Y+51 +Button B: X+43, Y+19 +Prize: X=19653, Y=2384 + +Button A: X+68, Y+17 +Button B: X+37, Y+73 +Prize: X=6386, Y=5804 + +Button A: X+63, Y+27 +Button B: X+12, Y+38 +Prize: X=7361, Y=15599 + +Button A: X+22, Y+87 +Button B: X+81, Y+13 +Prize: X=6224, Y=6174 + +Button A: X+70, Y+96 +Button B: X+67, Y+21 +Prize: X=9930, Y=10074 + +Button A: X+57, Y+23 +Button B: X+34, Y+66 +Prize: X=1295, Y=9225 + +Button A: X+25, Y+69 +Button B: X+41, Y+27 +Prize: X=3508, Y=4254 + +Button A: X+26, Y+65 +Button B: X+47, Y+21 +Prize: X=9769, Y=5583 + +Button A: X+35, Y+13 +Button B: X+32, Y+91 +Prize: X=3350, Y=5200 + +Button A: X+27, Y+73 +Button B: X+60, Y+35 +Prize: X=4098, Y=6627 + +Button A: X+23, Y+18 +Button B: X+11, Y+52 +Prize: X=1748, Y=2366 + +Button A: X+54, Y+17 +Button B: X+11, Y+61 +Prize: X=7660, Y=11300 + +Button A: X+18, Y+48 +Button B: X+67, Y+16 +Prize: X=9992, Y=2480 + +Button A: X+48, Y+25 +Button B: X+26, Y+61 +Prize: X=3910, Y=16886 + +Button A: X+22, Y+56 +Button B: X+59, Y+15 +Prize: X=3618, Y=15824 + +Button A: X+98, Y+21 +Button B: X+31, Y+48 +Prize: X=6283, Y=1884 + +Button A: X+17, Y+82 +Button B: X+60, Y+23 +Prize: X=1830, Y=7495 + +Button A: X+15, Y+58 +Button B: X+78, Y+37 +Prize: X=5052, Y=5246 + +Button A: X+51, Y+17 +Button B: X+13, Y+92 +Prize: X=4808, Y=2041 + +Button A: X+57, Y+14 +Button B: X+29, Y+91 +Prize: X=3287, Y=7182 + +Button A: X+31, Y+12 +Button B: X+11, Y+49 +Prize: X=11362, Y=7581 + +Button A: X+63, Y+31 +Button B: X+29, Y+96 +Prize: X=7469, Y=7680 + +Button A: X+28, Y+31 +Button B: X+98, Y+14 +Prize: X=9254, Y=1835 + +Button A: X+57, Y+36 +Button B: X+24, Y+70 +Prize: X=3168, Y=2988 + +Button A: X+68, Y+31 +Button B: X+12, Y+47 +Prize: X=13156, Y=8891 + +Button A: X+26, Y+90 +Button B: X+92, Y+31 +Prize: X=7198, Y=7381 + +Button A: X+55, Y+46 +Button B: X+99, Y+16 +Prize: X=10197, Y=2650 + +Button A: X+69, Y+48 +Button B: X+11, Y+94 +Prize: X=7023, Y=13434 + +Button A: X+44, Y+12 +Button B: X+13, Y+63 +Prize: X=18919, Y=17621 + +Button A: X+13, Y+58 +Button B: X+77, Y+24 +Prize: X=16515, Y=15288 + +Button A: X+54, Y+34 +Button B: X+16, Y+47 +Prize: X=15934, Y=3012 + +Button A: X+18, Y+98 +Button B: X+54, Y+17 +Prize: X=5994, Y=10474 + +Button A: X+93, Y+30 +Button B: X+41, Y+73 +Prize: X=6577, Y=4931 + +Button A: X+70, Y+92 +Button B: X+79, Y+24 +Prize: X=4874, Y=3532 + +Button A: X+37, Y+67 +Button B: X+60, Y+28 +Prize: X=9164, Y=9940 + +Button A: X+22, Y+72 +Button B: X+83, Y+69 +Prize: X=6711, Y=10413 + +Button A: X+13, Y+32 +Button B: X+29, Y+22 +Prize: X=10081, Y=10110 + +Button A: X+90, Y+77 +Button B: X+18, Y+61 +Prize: X=3438, Y=3899 + +Button A: X+21, Y+88 +Button B: X+81, Y+79 +Prize: X=8469, Y=14134 + +Button A: X+55, Y+16 +Button B: X+24, Y+64 +Prize: X=2225, Y=14448 + +Button A: X+14, Y+37 +Button B: X+58, Y+16 +Prize: X=15634, Y=19569 + +Button A: X+47, Y+29 +Button B: X+20, Y+49 +Prize: X=5167, Y=8809 + +Button A: X+47, Y+79 +Button B: X+94, Y+17 +Prize: X=4747, Y=3608 + +Button A: X+16, Y+12 +Button B: X+34, Y+90 +Prize: X=1782, Y=3078 + +Button A: X+87, Y+42 +Button B: X+53, Y+90 +Prize: X=8122, Y=5016 + +Button A: X+28, Y+58 +Button B: X+64, Y+28 +Prize: X=7352, Y=6968 + +Button A: X+75, Y+45 +Button B: X+12, Y+46 +Prize: X=18749, Y=16947 + +Button A: X+19, Y+41 +Button B: X+61, Y+26 +Prize: X=10002, Y=16534 + +Button A: X+27, Y+83 +Button B: X+96, Y+67 +Prize: X=6831, Y=8681 + +Button A: X+18, Y+86 +Button B: X+59, Y+45 +Prize: X=5008, Y=9240 + +Button A: X+84, Y+97 +Button B: X+39, Y+13 +Prize: X=1773, Y=798 + +Button A: X+12, Y+63 +Button B: X+60, Y+18 +Prize: X=4188, Y=3276 + +Button A: X+23, Y+43 +Button B: X+58, Y+32 +Prize: X=13694, Y=7172 + +Button A: X+41, Y+67 +Button B: X+96, Y+33 +Prize: X=11262, Y=7998 + +Button A: X+24, Y+51 +Button B: X+60, Y+16 +Prize: X=18644, Y=5895 + +Button A: X+42, Y+44 +Button B: X+16, Y+67 +Prize: X=3896, Y=7347 + +Button A: X+54, Y+77 +Button B: X+66, Y+15 +Prize: X=8286, Y=5961 + +Button A: X+14, Y+47 +Button B: X+75, Y+42 +Prize: X=13109, Y=2219 + +Button A: X+24, Y+73 +Button B: X+96, Y+64 +Prize: X=4608, Y=8088 + +Button A: X+17, Y+94 +Button B: X+67, Y+56 +Prize: X=5147, Y=11164 + +Button A: X+64, Y+95 +Button B: X+76, Y+32 +Prize: X=8300, Y=5128 + +Button A: X+25, Y+73 +Button B: X+54, Y+15 +Prize: X=10088, Y=2777 + +Button A: X+57, Y+16 +Button B: X+28, Y+62 +Prize: X=15188, Y=13990 + +Button A: X+62, Y+57 +Button B: X+15, Y+68 +Prize: X=4717, Y=8836 + +Button A: X+60, Y+13 +Button B: X+11, Y+40 +Prize: X=14252, Y=6806 + +Button A: X+97, Y+34 +Button B: X+16, Y+63 +Prize: X=8401, Y=4896 + +Button A: X+84, Y+29 +Button B: X+17, Y+99 +Prize: X=8450, Y=10554 + +Button A: X+97, Y+78 +Button B: X+18, Y+60 +Prize: X=8061, Y=9942 + +Button A: X+66, Y+25 +Button B: X+27, Y+67 +Prize: X=8834, Y=17803 + +Button A: X+96, Y+44 +Button B: X+29, Y+61 +Prize: X=1832, Y=2748 + +Button A: X+67, Y+41 +Button B: X+17, Y+32 +Prize: X=10972, Y=16424 + +Button A: X+14, Y+30 +Button B: X+57, Y+16 +Prize: X=4844, Y=19410 + +Button A: X+84, Y+18 +Button B: X+59, Y+66 +Prize: X=11204, Y=6456 + +Button A: X+48, Y+11 +Button B: X+16, Y+62 +Prize: X=8992, Y=8894 + +Button A: X+40, Y+21 +Button B: X+24, Y+44 +Prize: X=3512, Y=4136 + +Button A: X+37, Y+35 +Button B: X+54, Y+12 +Prize: X=4708, Y=1796 + +Button A: X+92, Y+12 +Button B: X+47, Y+95 +Prize: X=7584, Y=4544 + +Button A: X+96, Y+16 +Button B: X+42, Y+93 +Prize: X=6318, Y=1999 + +Button A: X+25, Y+58 +Button B: X+59, Y+27 +Prize: X=10433, Y=7150 + +Button A: X+34, Y+51 +Button B: X+84, Y+40 +Prize: X=10224, Y=7166 + +Button A: X+13, Y+76 +Button B: X+59, Y+12 +Prize: X=18974, Y=8992 + +Button A: X+32, Y+31 +Button B: X+14, Y+83 +Prize: X=2548, Y=7329 + +Button A: X+34, Y+94 +Button B: X+52, Y+13 +Prize: X=6358, Y=6463 + +Button A: X+24, Y+33 +Button B: X+47, Y+19 +Prize: X=5073, Y=3006 + +Button A: X+19, Y+63 +Button B: X+49, Y+15 +Prize: X=16481, Y=5627 + +Button A: X+17, Y+49 +Button B: X+83, Y+23 +Prize: X=6429, Y=5989 + +Button A: X+75, Y+54 +Button B: X+12, Y+28 +Prize: X=3383, Y=10382 + +Button A: X+47, Y+44 +Button B: X+81, Y+16 +Prize: X=7640, Y=1648 + +Button A: X+38, Y+14 +Button B: X+29, Y+50 +Prize: X=11822, Y=16106 + +Button A: X+77, Y+34 +Button B: X+23, Y+70 +Prize: X=3054, Y=3084 + +Button A: X+83, Y+24 +Button B: X+18, Y+63 +Prize: X=8358, Y=6867 + +Button A: X+71, Y+40 +Button B: X+23, Y+78 +Prize: X=7136, Y=5126 + +Button A: X+31, Y+81 +Button B: X+81, Y+50 +Prize: X=8228, Y=8729 + +Button A: X+98, Y+14 +Button B: X+43, Y+39 +Prize: X=2960, Y=2460 + +Button A: X+95, Y+62 +Button B: X+11, Y+41 +Prize: X=4992, Y=4002 + +Button A: X+79, Y+18 +Button B: X+32, Y+75 +Prize: X=3972, Y=4629 + +Button A: X+31, Y+76 +Button B: X+94, Y+12 +Prize: X=8634, Y=4128 + +Button A: X+58, Y+17 +Button B: X+24, Y+73 +Prize: X=8768, Y=10860 + +Button A: X+60, Y+16 +Button B: X+61, Y+96 +Prize: X=6182, Y=6592 + +Button A: X+63, Y+18 +Button B: X+33, Y+75 +Prize: X=16073, Y=14714 + +Button A: X+37, Y+15 +Button B: X+49, Y+75 +Prize: X=2391, Y=11285 + +Button A: X+69, Y+49 +Button B: X+14, Y+56 +Prize: X=6196, Y=7532 + +Button A: X+20, Y+61 +Button B: X+61, Y+20 +Prize: X=12379, Y=5286 + +Button A: X+39, Y+71 +Button B: X+25, Y+11 +Prize: X=1962, Y=1294 + +Button A: X+75, Y+34 +Button B: X+14, Y+40 +Prize: X=17099, Y=15930 + +Button A: X+88, Y+16 +Button B: X+25, Y+58 +Prize: X=4555, Y=3982 + +Button A: X+64, Y+73 +Button B: X+12, Y+72 +Prize: X=1352, Y=2825 + +Button A: X+20, Y+74 +Button B: X+48, Y+15 +Prize: X=4112, Y=3182 + +Button A: X+22, Y+37 +Button B: X+27, Y+15 +Prize: X=18362, Y=4145 + +Button A: X+20, Y+46 +Button B: X+52, Y+24 +Prize: X=8104, Y=15420 + +Button A: X+23, Y+54 +Button B: X+32, Y+16 +Prize: X=13407, Y=10166 + +Button A: X+79, Y+77 +Button B: X+80, Y+11 +Prize: X=15261, Y=8646 + +Button A: X+54, Y+27 +Button B: X+31, Y+56 +Prize: X=16561, Y=19116 + +Button A: X+22, Y+43 +Button B: X+76, Y+40 +Prize: X=5000, Y=4454 + +Button A: X+69, Y+98 +Button B: X+89, Y+36 +Prize: X=5019, Y=6586 + +Button A: X+58, Y+40 +Button B: X+14, Y+35 +Prize: X=19282, Y=6535 + +Button A: X+60, Y+65 +Button B: X+61, Y+17 +Prize: X=6744, Y=3183 + +Button A: X+32, Y+71 +Button B: X+43, Y+15 +Prize: X=19388, Y=6017 + +Button A: X+25, Y+68 +Button B: X+90, Y+45 +Prize: X=6460, Y=5783 + +Button A: X+48, Y+17 +Button B: X+63, Y+84 +Prize: X=4113, Y=4356 + +Button A: X+30, Y+99 +Button B: X+93, Y+33 +Prize: X=4743, Y=9900 + +Button A: X+62, Y+19 +Button B: X+13, Y+82 +Prize: X=2907, Y=1593 + +Button A: X+21, Y+42 +Button B: X+56, Y+36 +Prize: X=11127, Y=3362 + +Button A: X+24, Y+11 +Button B: X+13, Y+44 +Prize: X=6870, Y=5006 + +Button A: X+94, Y+62 +Button B: X+11, Y+22 +Prize: X=9446, Y=7174 + +Button A: X+16, Y+64 +Button B: X+82, Y+35 +Prize: X=3918, Y=229 + +Button A: X+52, Y+78 +Button B: X+37, Y+16 +Prize: X=7082, Y=13428 + +Button A: X+15, Y+68 +Button B: X+45, Y+16 +Prize: X=3695, Y=5912 + +Button A: X+21, Y+84 +Button B: X+51, Y+29 +Prize: X=4935, Y=9940 + +Button A: X+75, Y+28 +Button B: X+11, Y+44 +Prize: X=13726, Y=10856 + +Button A: X+22, Y+58 +Button B: X+66, Y+17 +Prize: X=7316, Y=1998 + +Button A: X+88, Y+23 +Button B: X+38, Y+61 +Prize: X=9878, Y=6514 + +Button A: X+40, Y+70 +Button B: X+49, Y+19 +Prize: X=2710, Y=13540 + +Button A: X+27, Y+51 +Button B: X+84, Y+27 +Prize: X=10278, Y=6774 + +Button A: X+15, Y+58 +Button B: X+46, Y+18 +Prize: X=13233, Y=696 + +Button A: X+73, Y+30 +Button B: X+12, Y+60 +Prize: X=2464, Y=2940 + +Button A: X+73, Y+36 +Button B: X+18, Y+45 +Prize: X=6728, Y=4221 + +Button A: X+20, Y+38 +Button B: X+51, Y+20 +Prize: X=4509, Y=2492 + +Button A: X+12, Y+57 +Button B: X+56, Y+19 +Prize: X=1180, Y=4370 + +Button A: X+18, Y+74 +Button B: X+91, Y+39 +Prize: X=2713, Y=6797 + +Button A: X+13, Y+27 +Button B: X+54, Y+12 +Prize: X=924, Y=1218 + +Button A: X+13, Y+79 +Button B: X+63, Y+50 +Prize: X=5645, Y=6678 + +Button A: X+61, Y+28 +Button B: X+13, Y+53 +Prize: X=18905, Y=11326 + +Button A: X+23, Y+38 +Button B: X+94, Y+39 +Prize: X=4360, Y=2435 + +Button A: X+86, Y+20 +Button B: X+38, Y+59 +Prize: X=6476, Y=6422 + +Button A: X+12, Y+54 +Button B: X+50, Y+18 +Prize: X=16766, Y=5660 + +Button A: X+15, Y+95 +Button B: X+68, Y+60 +Prize: X=3883, Y=9395 + +Button A: X+13, Y+30 +Button B: X+74, Y+43 +Prize: X=17495, Y=19762 + +Button A: X+19, Y+46 +Button B: X+69, Y+26 +Prize: X=723, Y=8622 + +Button A: X+54, Y+18 +Button B: X+14, Y+33 +Prize: X=366, Y=13862 + +Button A: X+71, Y+36 +Button B: X+18, Y+46 +Prize: X=4690, Y=2968 + +Button A: X+97, Y+68 +Button B: X+19, Y+68 +Prize: X=5065, Y=8636 + +Button A: X+39, Y+76 +Button B: X+47, Y+13 +Prize: X=7571, Y=3589 + +Button A: X+51, Y+19 +Button B: X+23, Y+70 +Prize: X=6566, Y=12027 + +Button A: X+39, Y+59 +Button B: X+75, Y+22 +Prize: X=4818, Y=1984 + +Button A: X+97, Y+14 +Button B: X+71, Y+77 +Prize: X=15444, Y=7903 + +Button A: X+40, Y+28 +Button B: X+35, Y+82 +Prize: X=4050, Y=6860 + +Button A: X+23, Y+23 +Button B: X+76, Y+16 +Prize: X=2842, Y=1942 + +Button A: X+64, Y+36 +Button B: X+25, Y+49 +Prize: X=3864, Y=5248 + +Button A: X+34, Y+63 +Button B: X+20, Y+11 +Prize: X=10418, Y=15778 + +Button A: X+73, Y+24 +Button B: X+49, Y+86 +Prize: X=5359, Y=8052 + +Button A: X+34, Y+82 +Button B: X+51, Y+13 +Prize: X=11073, Y=1219 + +Button A: X+34, Y+96 +Button B: X+97, Y+76 +Prize: X=7805, Y=7988 + +Button A: X+69, Y+40 +Button B: X+26, Y+52 +Prize: X=12331, Y=3644 + +Button A: X+94, Y+29 +Button B: X+35, Y+58 +Prize: X=8190, Y=4698 + +Button A: X+32, Y+79 +Button B: X+77, Y+18 +Prize: X=6541, Y=4962 + +Button A: X+12, Y+83 +Button B: X+87, Y+11 +Prize: X=7976, Y=18341 + +Button A: X+91, Y+33 +Button B: X+48, Y+78 +Prize: X=12379, Y=8973 + +Button A: X+99, Y+42 +Button B: X+26, Y+92 +Prize: X=3348, Y=5064 + +Button A: X+15, Y+60 +Button B: X+62, Y+20 +Prize: X=3655, Y=10840 + +Button A: X+29, Y+61 +Button B: X+58, Y+28 +Prize: X=12676, Y=19276 + +Button A: X+16, Y+82 +Button B: X+79, Y+28 +Prize: X=1021, Y=4102 + +Button A: X+36, Y+14 +Button B: X+21, Y+50 +Prize: X=1514, Y=6638 + +Button A: X+42, Y+59 +Button B: X+97, Y+26 +Prize: X=8779, Y=6268 + +Button A: X+67, Y+13 +Button B: X+87, Y+95 +Prize: X=6726, Y=7164 + +Button A: X+51, Y+42 +Button B: X+23, Y+72 +Prize: X=4048, Y=7260 + +Button A: X+31, Y+72 +Button B: X+18, Y+12 +Prize: X=3629, Y=7296 + +Button A: X+40, Y+59 +Button B: X+80, Y+21 +Prize: X=1760, Y=947 + +Button A: X+11, Y+38 +Button B: X+50, Y+14 +Prize: X=1815, Y=18132 + +Button A: X+98, Y+70 +Button B: X+24, Y+59 +Prize: X=6266, Y=4978 + +Button A: X+53, Y+15 +Button B: X+77, Y+95 +Prize: X=905, Y=915 + +Button A: X+93, Y+51 +Button B: X+17, Y+80 +Prize: X=3846, Y=8046 + +Button A: X+12, Y+62 +Button B: X+96, Y+82 +Prize: X=6420, Y=5846 + +Button A: X+23, Y+99 +Button B: X+45, Y+48 +Prize: X=2096, Y=2757 + +Button A: X+77, Y+15 +Button B: X+15, Y+61 +Prize: X=14426, Y=16046 + +Button A: X+34, Y+14 +Button B: X+23, Y+31 +Prize: X=17470, Y=6594 + +Button A: X+84, Y+24 +Button B: X+46, Y+96 +Prize: X=7464, Y=7104 + +Button A: X+32, Y+68 +Button B: X+63, Y+24 +Prize: X=13372, Y=7132 + +Button A: X+42, Y+13 +Button B: X+47, Y+73 +Prize: X=11393, Y=3677 + +Button A: X+39, Y+16 +Button B: X+43, Y+74 +Prize: X=12111, Y=9106 + +Button A: X+64, Y+80 +Button B: X+47, Y+16 +Prize: X=3879, Y=1728 + +Button A: X+44, Y+40 +Button B: X+90, Y+18 +Prize: X=9688, Y=2936 + +Button A: X+96, Y+36 +Button B: X+36, Y+64 +Prize: X=3456, Y=5740 + +Button A: X+12, Y+81 +Button B: X+60, Y+31 +Prize: X=4836, Y=6463 + +Button A: X+28, Y+46 +Button B: X+79, Y+34 +Prize: X=5949, Y=4122 + +Button A: X+29, Y+84 +Button B: X+73, Y+51 +Prize: X=8238, Y=9261 + +Button A: X+61, Y+15 +Button B: X+14, Y+62 +Prize: X=12073, Y=12411 + +Button A: X+29, Y+13 +Button B: X+14, Y+32 +Prize: X=8805, Y=1677 + +Button A: X+37, Y+72 +Button B: X+40, Y+16 +Prize: X=17919, Y=14712 + +Button A: X+14, Y+43 +Button B: X+56, Y+21 +Prize: X=8026, Y=6925 + +Button A: X+53, Y+15 +Button B: X+30, Y+64 +Prize: X=2437, Y=2355 + +Button A: X+40, Y+65 +Button B: X+44, Y+15 +Prize: X=2048, Y=5280 + +Button A: X+30, Y+17 +Button B: X+16, Y+34 +Prize: X=11858, Y=1961 + +Button A: X+54, Y+17 +Button B: X+67, Y+76 +Prize: X=6016, Y=2443 + +Button A: X+12, Y+58 +Button B: X+51, Y+12 +Prize: X=2246, Y=13106 + +Button A: X+13, Y+30 +Button B: X+62, Y+14 +Prize: X=16172, Y=9898 + +Button A: X+97, Y+83 +Button B: X+29, Y+93 +Prize: X=3909, Y=10027 + +Button A: X+11, Y+70 +Button B: X+77, Y+26 +Prize: X=1881, Y=4082 + +Button A: X+72, Y+17 +Button B: X+72, Y+86 +Prize: X=2664, Y=2699 + +Button A: X+13, Y+40 +Button B: X+99, Y+62 +Prize: X=3789, Y=4380 + +Button A: X+76, Y+77 +Button B: X+15, Y+68 +Prize: X=4074, Y=8035 + +Button A: X+85, Y+51 +Button B: X+12, Y+33 +Prize: X=8771, Y=6759 + +Button A: X+48, Y+99 +Button B: X+94, Y+50 +Prize: X=5722, Y=5615 + +Button A: X+25, Y+73 +Button B: X+56, Y+22 +Prize: X=6614, Y=6010 + +Button A: X+46, Y+34 +Button B: X+13, Y+91 +Prize: X=4217, Y=4175 + +Button A: X+60, Y+58 +Button B: X+13, Y+53 +Prize: X=6137, Y=9531 + +Button A: X+27, Y+59 +Button B: X+46, Y+18 +Prize: X=4171, Y=2843 + +Button A: X+98, Y+90 +Button B: X+20, Y+90 +Prize: X=5418, Y=6480 + +Button A: X+34, Y+64 +Button B: X+45, Y+12 +Prize: X=2503, Y=11980 + +Button A: X+32, Y+11 +Button B: X+14, Y+33 +Prize: X=9516, Y=14510 + +Button A: X+11, Y+59 +Button B: X+55, Y+14 +Prize: X=1189, Y=1697 diff --git a/day13_sample.txt b/day13_sample.txt @@ -0,0 +1,15 @@ +Button A: X+94, Y+34 +Button B: X+22, Y+67 +Prize: X=8400, Y=5400 + +Button A: X+26, Y+66 +Button B: X+67, Y+21 +Prize: X=12748, Y=12176 + +Button A: X+17, Y+86 +Button B: X+84, Y+37 +Prize: X=7870, Y=6450 + +Button A: X+69, Y+23 +Button B: X+27, Y+71 +Prize: X=18641, Y=10279 diff --git a/src/main/java/day13_pt1.java b/src/main/java/day13_pt1.java @@ -0,0 +1,93 @@ +import java.nio.file.Files; +import java.nio.file.Path; +import java.io.IOException; +import java.util.*; +import java.util.stream.*; +import java.util.regex.*; + +class day13_pt1 { + // A * 94 + B * 22 = 8400 + // A * 34 + B * 67 = 5400 + // How many solutions does it have? + // Identify the A coefficent + // Multiply each side by the A coefficient of the other + // A * 3196 + B * 748 = 285600 + // A * 3196 + B * 6298 = 507600 + // Subtract one from the other so the A coefficients are cancelled to zero + // B * -5550 = -222000 + // Divide the constant side by the remaining B coefficient; INTEGERS ONLY here, if we have a remainder then bail, can't solve. + // B = 40 + // Substitute back into the original equation to find A OR repeat the process with the B coefficient to find A + // Multiply each side by the B coefficient of the other + // A * 6298 + B * 1474 = 562800 + // A * 748 + B * 1474 = 118800 + // A * 5550 = 444000 + // A = 80 + // So; we have a red herring about minimisation; simultaneous equations only have one solution it seems + // + // I'm pretty sure this problem lends itself really well to vector / matrix math but I can't remember exactly how to get there from here + // We'll do it simply + static final Pattern A = Pattern.compile("Button A: X\\+(\\d+), Y\\+(\\d+)"); + static final Pattern B = Pattern.compile("Button B: X\\+(\\d+), Y\\+(\\d+)"); + static final Pattern Z = Pattern.compile("Prize: X=(\\d+), Y=(\\d+)"); + public static void main(String[] args) throws IOException { + + var lines = Files.readAllLines(Path.of(args[0])); + var res = 0l; + for (int i=0; i< lines.size(); i+=4) { + var aline = lines.get(i); + var bline = lines.get(i+1); + var zline = lines.get(i+2); + var am = A.matcher(aline); + if (!am.matches()) throw new RuntimeException("line doesn't match [%s]".formatted(aline)); + var ax = Long.parseLong(am.group(1)); + var ay = Long.parseLong(am.group(2)); + + var bm = B.matcher(bline); + if (!bm.matches()) throw new RuntimeException("line doesn't match [%s]".formatted(bline)); + var bx = Long.parseLong(bm.group(1)); + var by = Long.parseLong(bm.group(2)); + + 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)); + //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 + { + var c1 = zx * by - zy * bx; + var c2 = ax * by - ay * bx; + + if (c1 % c2 != 0) { + //System.out.println("non-integer result, skipping"); + continue; + } + var a = c1 / c2; + //System.out.printf("A = %d\n", a); + if (a > 100) { + //System.out.println("A is too big, skipping"); + } + res += (3 * a); + } + // Solve for B + { + var c1 = zx * ay - zy * ax; + var c2 = bx * ay - by * ax; + if (c1 % c2 != 0) { + //System.out.println("non-integer result, skipping"); + continue; + } + var b = c1 / c2; + //System.out.printf("B = %d\n", b); + if (b > 100) { + //System.out.println("B is too big, skipping"); + continue; + } + res += b; + } + //System.out.println(""); + } + System.out.printf("Day 13, pt1 = %d\n", res); + } +}