- commit
- 92319530e73d7c740d1673378d919d252205af84
- parent
- 378bcf2c8977e8eacfa7b74af062343c6e4fdbef
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2024-12-13 07:10
2024-12-13
Diffstat
A | 2024/13/input.txt | 1279 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | 2024/13/solution.rs | 66 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | 2024/13/test.txt | 15 | +++++++++++++++ |
3 files changed, 1360 insertions, 0 deletions
diff --git a/2024/13/input.txt b/2024/13/input.txt
@@ -0,0 +1,1279 @@ -1 1 Button A: X+44, Y+17 -1 2 Button B: X+28, Y+68 -1 3 Prize: X=13736, Y=11226 -1 4 -1 5 Button A: X+45, Y+82 -1 6 Button B: X+79, Y+11 -1 7 Prize: X=8906, Y=6390 -1 8 -1 9 Button A: X+81, Y+11 -1 10 Button B: X+84, Y+89 -1 11 Prize: X=12933, Y=9438 -1 12 -1 13 Button A: X+13, Y+88 -1 14 Button B: X+94, Y+72 -1 15 Prize: X=6101, Y=6312 -1 16 -1 17 Button A: X+48, Y+24 -1 18 Button B: X+14, Y+24 -1 19 Prize: X=9182, Y=13400 -1 20 -1 21 Button A: X+95, Y+95 -1 22 Button B: X+18, Y+82 -1 23 Prize: X=3067, Y=6203 -1 24 -1 25 Button A: X+35, Y+16 -1 26 Button B: X+19, Y+47 -1 27 Prize: X=6861, Y=7675 -1 28 -1 29 Button A: X+38, Y+52 -1 30 Button B: X+72, Y+25 -1 31 Prize: X=2714, Y=2611 -1 32 -1 33 Button A: X+11, Y+84 -1 34 Button B: X+84, Y+12 -1 35 Prize: X=14128, Y=8120 -1 36 -1 37 Button A: X+80, Y+33 -1 38 Button B: X+24, Y+79 -1 39 Prize: X=4328, Y=8488 -1 40 -1 41 Button A: X+18, Y+48 -1 42 Button B: X+23, Y+11 -1 43 Prize: X=17816, Y=16130 -1 44 -1 45 Button A: X+23, Y+37 -1 46 Button B: X+90, Y+28 -1 47 Prize: X=1831, Y=1077 -1 48 -1 49 Button A: X+23, Y+59 -1 50 Button B: X+57, Y+22 -1 51 Prize: X=3673, Y=9424 -1 52 -1 53 Button A: X+43, Y+11 -1 54 Button B: X+27, Y+61 -1 55 Prize: X=11999, Y=2559 -1 56 -1 57 Button A: X+15, Y+52 -1 58 Button B: X+78, Y+38 -1 59 Prize: X=12116, Y=1704 -1 60 -1 61 Button A: X+13, Y+51 -1 62 Button B: X+74, Y+34 -1 63 Prize: X=18504, Y=1672 -1 64 -1 65 Button A: X+25, Y+52 -1 66 Button B: X+43, Y+27 -1 67 Prize: X=16970, Y=19095 -1 68 -1 69 Button A: X+11, Y+73 -1 70 Button B: X+84, Y+87 -1 71 Prize: X=2766, Y=4713 -1 72 -1 73 Button A: X+16, Y+50 -1 74 Button B: X+69, Y+16 -1 75 Prize: X=18250, Y=4500 -1 76 -1 77 Button A: X+57, Y+36 -1 78 Button B: X+11, Y+30 -1 79 Prize: X=3609, Y=5180 -1 80 -1 81 Button A: X+83, Y+57 -1 82 Button B: X+12, Y+31 -1 83 Prize: X=12528, Y=17116 -1 84 -1 85 Button A: X+51, Y+26 -1 86 Button B: X+38, Y+66 -1 87 Prize: X=12977, Y=13356 -1 88 -1 89 Button A: X+58, Y+32 -1 90 Button B: X+21, Y+91 -1 91 Prize: X=5071, Y=8595 -1 92 -1 93 Button A: X+72, Y+52 -1 94 Button B: X+16, Y+86 -1 95 Prize: X=6912, Y=7672 -1 96 -1 97 Button A: X+11, Y+50 -1 98 Button B: X+87, Y+21 -1 99 Prize: X=1783, Y=4360 -1 100 -1 101 Button A: X+28, Y+95 -1 102 Button B: X+68, Y+29 -1 103 Prize: X=3344, Y=4084 -1 104 -1 105 Button A: X+70, Y+29 -1 106 Button B: X+14, Y+47 -1 107 Prize: X=2958, Y=15887 -1 108 -1 109 Button A: X+15, Y+66 -1 110 Button B: X+39, Y+13 -1 111 Prize: X=2972, Y=7253 -1 112 -1 113 Button A: X+80, Y+72 -1 114 Button B: X+14, Y+61 -1 115 Prize: X=2892, Y=7346 -1 116 -1 117 Button A: X+22, Y+70 -1 118 Button B: X+59, Y+12 -1 119 Prize: X=1341, Y=16544 -1 120 -1 121 Button A: X+56, Y+14 -1 122 Button B: X+58, Y+68 -1 123 Prize: X=7046, Y=5988 -1 124 -1 125 Button A: X+48, Y+19 -1 126 Button B: X+30, Y+69 -1 127 Prize: X=3134, Y=9547 -1 128 -1 129 Button A: X+13, Y+69 -1 130 Button B: X+84, Y+21 -1 131 Prize: X=17327, Y=9221 -1 132 -1 133 Button A: X+61, Y+18 -1 134 Button B: X+23, Y+58 -1 135 Prize: X=5481, Y=7366 -1 136 -1 137 Button A: X+19, Y+75 -1 138 Button B: X+64, Y+17 -1 139 Prize: X=7118, Y=2036 -1 140 -1 141 Button A: X+77, Y+53 -1 142 Button B: X+17, Y+42 -1 143 Prize: X=4993, Y=6463 -1 144 -1 145 Button A: X+22, Y+91 -1 146 Button B: X+83, Y+22 -1 147 Prize: X=1304, Y=1538 -1 148 -1 149 Button A: X+72, Y+14 -1 150 Button B: X+18, Y+82 -1 151 Prize: X=16730, Y=7650 -1 152 -1 153 Button A: X+22, Y+69 -1 154 Button B: X+58, Y+18 -1 155 Prize: X=8266, Y=15413 -1 156 -1 157 Button A: X+91, Y+30 -1 158 Button B: X+11, Y+98 -1 159 Prize: X=4148, Y=8068 -1 160 -1 161 Button A: X+41, Y+97 -1 162 Button B: X+95, Y+49 -1 163 Prize: X=5233, Y=4823 -1 164 -1 165 Button A: X+27, Y+71 -1 166 Button B: X+49, Y+38 -1 167 Prize: X=5512, Y=6227 -1 168 -1 169 Button A: X+38, Y+59 -1 170 Button B: X+48, Y+21 -1 171 Prize: X=1508, Y=13802 -1 172 -1 173 Button A: X+20, Y+66 -1 174 Button B: X+39, Y+16 -1 175 Prize: X=5759, Y=9094 -1 176 -1 177 Button A: X+28, Y+49 -1 178 Button B: X+61, Y+34 -1 179 Prize: X=2331, Y=10929 -1 180 -1 181 Button A: X+36, Y+12 -1 182 Button B: X+32, Y+48 -1 183 Prize: X=6676, Y=380 -1 184 -1 185 Button A: X+29, Y+99 -1 186 Button B: X+64, Y+15 -1 187 Prize: X=5364, Y=7527 -1 188 -1 189 Button A: X+28, Y+76 -1 190 Button B: X+66, Y+20 -1 191 Prize: X=4834, Y=11484 -1 192 -1 193 Button A: X+16, Y+48 -1 194 Button B: X+57, Y+33 -1 195 Prize: X=13558, Y=16646 -1 196 -1 197 Button A: X+14, Y+67 -1 198 Button B: X+97, Y+64 -1 199 Prize: X=2118, Y=6134 -1 200 -1 201 Button A: X+56, Y+19 -1 202 Button B: X+39, Y+77 -1 203 Prize: X=15954, Y=948 -1 204 -1 205 Button A: X+78, Y+36 -1 206 Button B: X+32, Y+87 -1 207 Prize: X=4814, Y=7278 -1 208 -1 209 Button A: X+35, Y+82 -1 210 Button B: X+92, Y+51 -1 211 Prize: X=5417, Y=5945 -1 212 -1 213 Button A: X+22, Y+56 -1 214 Button B: X+68, Y+37 -1 215 Prize: X=11748, Y=13276 -1 216 -1 217 Button A: X+45, Y+90 -1 218 Button B: X+97, Y+36 -1 219 Prize: X=6416, Y=9198 -1 220 -1 221 Button A: X+24, Y+47 -1 222 Button B: X+67, Y+18 -1 223 Prize: X=4275, Y=4636 -1 224 -1 225 Button A: X+59, Y+83 -1 226 Button B: X+27, Y+11 -1 227 Prize: X=5178, Y=18866 -1 228 -1 229 Button A: X+29, Y+14 -1 230 Button B: X+38, Y+59 -1 231 Prize: X=3422, Y=4010 -1 232 -1 233 Button A: X+13, Y+67 -1 234 Button B: X+74, Y+27 -1 235 Prize: X=10476, Y=11200 -1 236 -1 237 Button A: X+16, Y+41 -1 238 Button B: X+65, Y+32 -1 239 Prize: X=4467, Y=17280 -1 240 -1 241 Button A: X+70, Y+29 -1 242 Button B: X+16, Y+63 -1 243 Prize: X=10028, Y=11676 -1 244 -1 245 Button A: X+43, Y+15 -1 246 Button B: X+27, Y+41 -1 247 Prize: X=16621, Y=14031 -1 248 -1 249 Button A: X+65, Y+37 -1 250 Button B: X+18, Y+88 -1 251 Prize: X=5842, Y=9468 -1 252 -1 253 Button A: X+95, Y+47 -1 254 Button B: X+15, Y+76 -1 255 Prize: X=8645, Y=9489 -1 256 -1 257 Button A: X+44, Y+87 -1 258 Button B: X+84, Y+23 -1 259 Prize: X=1776, Y=2510 -1 260 -1 261 Button A: X+63, Y+20 -1 262 Button B: X+28, Y+69 -1 263 Prize: X=5978, Y=3100 -1 264 -1 265 Button A: X+25, Y+53 -1 266 Button B: X+32, Y+11 -1 267 Prize: X=17829, Y=19516 -1 268 -1 269 Button A: X+22, Y+71 -1 270 Button B: X+50, Y+12 -1 271 Prize: X=10934, Y=18746 -1 272 -1 273 Button A: X+13, Y+27 -1 274 Button B: X+61, Y+24 -1 275 Prize: X=6987, Y=18278 -1 276 -1 277 Button A: X+21, Y+71 -1 278 Button B: X+56, Y+14 -1 279 Prize: X=14109, Y=17227 -1 280 -1 281 Button A: X+13, Y+47 -1 282 Button B: X+75, Y+23 -1 283 Prize: X=8672, Y=2174 -1 284 -1 285 Button A: X+12, Y+31 -1 286 Button B: X+84, Y+62 -1 287 Prize: X=3620, Y=16855 -1 288 -1 289 Button A: X+22, Y+76 -1 290 Button B: X+54, Y+13 -1 291 Prize: X=5094, Y=2499 -1 292 -1 293 Button A: X+17, Y+81 -1 294 Button B: X+89, Y+84 -1 295 Prize: X=3592, Y=6573 -1 296 -1 297 Button A: X+17, Y+55 -1 298 Button B: X+71, Y+31 -1 299 Prize: X=14465, Y=8867 -1 300 -1 301 Button A: X+68, Y+73 -1 302 Button B: X+70, Y+11 -1 303 Prize: X=5658, Y=3444 -1 304 -1 305 Button A: X+34, Y+65 -1 306 Button B: X+55, Y+22 -1 307 Prize: X=7050, Y=11058 -1 308 -1 309 Button A: X+42, Y+17 -1 310 Button B: X+12, Y+57 -1 311 Prize: X=4340, Y=3970 -1 312 -1 313 Button A: X+27, Y+47 -1 314 Button B: X+37, Y+18 -1 315 Prize: X=7500, Y=18692 -1 316 -1 317 Button A: X+13, Y+39 -1 318 Button B: X+64, Y+34 -1 319 Prize: X=7671, Y=1527 -1 320 -1 321 Button A: X+56, Y+20 -1 322 Button B: X+11, Y+32 -1 323 Prize: X=11587, Y=916 -1 324 -1 325 Button A: X+63, Y+15 -1 326 Button B: X+32, Y+82 -1 327 Prize: X=11332, Y=12954 -1 328 -1 329 Button A: X+51, Y+24 -1 330 Button B: X+14, Y+38 -1 331 Prize: X=5645, Y=18686 -1 332 -1 333 Button A: X+11, Y+37 -1 334 Button B: X+49, Y+29 -1 335 Prize: X=921, Y=789 -1 336 -1 337 Button A: X+36, Y+81 -1 338 Button B: X+62, Y+15 -1 339 Prize: X=428, Y=9890 -1 340 -1 341 Button A: X+11, Y+37 -1 342 Button B: X+65, Y+15 -1 343 Prize: X=10375, Y=1385 -1 344 -1 345 Button A: X+44, Y+31 -1 346 Button B: X+14, Y+89 -1 347 Prize: X=4416, Y=4694 -1 348 -1 349 Button A: X+45, Y+83 -1 350 Button B: X+83, Y+48 -1 351 Prize: X=10607, Y=11262 -1 352 -1 353 Button A: X+79, Y+12 -1 354 Button B: X+12, Y+81 -1 355 Prize: X=14104, Y=5297 -1 356 -1 357 Button A: X+66, Y+36 -1 358 Button B: X+13, Y+47 -1 359 Prize: X=190, Y=2382 -1 360 -1 361 Button A: X+25, Y+53 -1 362 Button B: X+31, Y+15 -1 363 Prize: X=18365, Y=3909 -1 364 -1 365 Button A: X+87, Y+38 -1 366 Button B: X+12, Y+41 -1 367 Prize: X=5127, Y=3777 -1 368 -1 369 Button A: X+75, Y+19 -1 370 Button B: X+56, Y+77 -1 371 Prize: X=6844, Y=6382 -1 372 -1 373 Button A: X+86, Y+44 -1 374 Button B: X+16, Y+36 -1 375 Prize: X=5230, Y=5040 -1 376 -1 377 Button A: X+41, Y+12 -1 378 Button B: X+16, Y+70 -1 379 Prize: X=17465, Y=18832 -1 380 -1 381 Button A: X+49, Y+68 -1 382 Button B: X+62, Y+27 -1 383 Prize: X=6998, Y=4634 -1 384 -1 385 Button A: X+84, Y+63 -1 386 Button B: X+15, Y+99 -1 387 Prize: X=7203, Y=7245 -1 388 -1 389 Button A: X+32, Y+63 -1 390 Button B: X+41, Y+16 -1 391 Prize: X=17232, Y=12724 -1 392 -1 393 Button A: X+28, Y+53 -1 394 Button B: X+47, Y+16 -1 395 Prize: X=17378, Y=18764 -1 396 -1 397 Button A: X+33, Y+15 -1 398 Button B: X+12, Y+68 -1 399 Prize: X=1773, Y=2307 -1 400 -1 401 Button A: X+37, Y+53 -1 402 Button B: X+24, Y+11 -1 403 Prize: X=11740, Y=11110 -1 404 -1 405 Button A: X+15, Y+28 -1 406 Button B: X+57, Y+30 -1 407 Prize: X=1571, Y=9214 -1 408 -1 409 Button A: X+22, Y+96 -1 410 Button B: X+90, Y+64 -1 411 Prize: X=2236, Y=3840 -1 412 -1 413 Button A: X+86, Y+16 -1 414 Button B: X+13, Y+13 -1 415 Prize: X=5952, Y=1192 -1 416 -1 417 Button A: X+61, Y+18 -1 418 Button B: X+32, Y+37 -1 419 Prize: X=7304, Y=4663 -1 420 -1 421 Button A: X+29, Y+60 -1 422 Button B: X+64, Y+26 -1 423 Prize: X=7221, Y=786 -1 424 -1 425 Button A: X+62, Y+27 -1 426 Button B: X+17, Y+61 -1 427 Prize: X=6605, Y=16984 -1 428 -1 429 Button A: X+98, Y+49 -1 430 Button B: X+15, Y+98 -1 431 Prize: X=7095, Y=10878 -1 432 -1 433 Button A: X+62, Y+34 -1 434 Button B: X+22, Y+45 -1 435 Prize: X=12276, Y=14000 -1 436 -1 437 Button A: X+17, Y+43 -1 438 Button B: X+77, Y+49 -1 439 Prize: X=2036, Y=16856 -1 440 -1 441 Button A: X+38, Y+33 -1 442 Button B: X+20, Y+94 -1 443 Prize: X=2626, Y=9867 -1 444 -1 445 Button A: X+24, Y+67 -1 446 Button B: X+66, Y+28 -1 447 Prize: X=5388, Y=6604 -1 448 -1 449 Button A: X+74, Y+89 -1 450 Button B: X+11, Y+76 -1 451 Prize: X=4761, Y=10936 -1 452 -1 453 Button A: X+15, Y+47 -1 454 Button B: X+44, Y+17 -1 455 Prize: X=12840, Y=6497 -1 456 -1 457 Button A: X+99, Y+78 -1 458 Button B: X+34, Y+89 -1 459 Prize: X=7254, Y=7395 -1 460 -1 461 Button A: X+62, Y+17 -1 462 Button B: X+30, Y+80 -1 463 Prize: X=4608, Y=14928 -1 464 -1 465 Button A: X+82, Y+46 -1 466 Button B: X+36, Y+93 -1 467 Prize: X=2766, Y=3663 -1 468 -1 469 Button A: X+13, Y+95 -1 470 Button B: X+75, Y+51 -1 471 Prize: X=6297, Y=10227 -1 472 -1 473 Button A: X+78, Y+21 -1 474 Button B: X+43, Y+64 -1 475 Prize: X=8779, Y=6505 -1 476 -1 477 Button A: X+71, Y+11 -1 478 Button B: X+55, Y+87 -1 479 Prize: X=1471, Y=1719 -1 480 -1 481 Button A: X+13, Y+43 -1 482 Button B: X+27, Y+16 -1 483 Prize: X=9344, Y=1441 -1 484 -1 485 Button A: X+22, Y+39 -1 486 Button B: X+38, Y+22 -1 487 Prize: X=3346, Y=4117 -1 488 -1 489 Button A: X+74, Y+46 -1 490 Button B: X+14, Y+61 -1 491 Prize: X=3812, Y=6658 -1 492 -1 493 Button A: X+12, Y+51 -1 494 Button B: X+77, Y+23 -1 495 Prize: X=9400, Y=13651 -1 496 -1 497 Button A: X+57, Y+16 -1 498 Button B: X+17, Y+68 -1 499 Prize: X=19280, Y=2976 -1 500 -1 501 Button A: X+51, Y+25 -1 502 Button B: X+26, Y+63 -1 503 Prize: X=3067, Y=17639 -1 504 -1 505 Button A: X+19, Y+75 -1 506 Button B: X+52, Y+13 -1 507 Prize: X=6759, Y=16632 -1 508 -1 509 Button A: X+11, Y+22 -1 510 Button B: X+39, Y+21 -1 511 Prize: X=3694, Y=3227 -1 512 -1 513 Button A: X+18, Y+25 -1 514 Button B: X+97, Y+43 -1 515 Prize: X=5555, Y=2854 -1 516 -1 517 Button A: X+76, Y+21 -1 518 Button B: X+12, Y+72 -1 519 Prize: X=2560, Y=3020 -1 520 -1 521 Button A: X+23, Y+78 -1 522 Button B: X+71, Y+18 -1 523 Prize: X=7519, Y=5690 -1 524 -1 525 Button A: X+47, Y+20 -1 526 Button B: X+44, Y+70 -1 527 Prize: X=15882, Y=1900 -1 528 -1 529 Button A: X+92, Y+58 -1 530 Button B: X+23, Y+88 -1 531 Prize: X=6049, Y=9914 -1 532 -1 533 Button A: X+14, Y+78 -1 534 Button B: X+69, Y+60 -1 535 Prize: X=3920, Y=8214 -1 536 -1 537 Button A: X+83, Y+53 -1 538 Button B: X+13, Y+37 -1 539 Prize: X=9099, Y=849 -1 540 -1 541 Button A: X+45, Y+93 -1 542 Button B: X+97, Y+63 -1 543 Prize: X=3639, Y=5871 -1 544 -1 545 Button A: X+25, Y+96 -1 546 Button B: X+43, Y+26 -1 547 Prize: X=1429, Y=5070 -1 548 -1 549 Button A: X+55, Y+32 -1 550 Button B: X+14, Y+46 -1 551 Prize: X=16108, Y=17064 -1 552 -1 553 Button A: X+37, Y+15 -1 554 Button B: X+42, Y+57 -1 555 Prize: X=9465, Y=2744 -1 556 -1 557 Button A: X+20, Y+65 -1 558 Button B: X+87, Y+20 -1 559 Prize: X=7990, Y=2320 -1 560 -1 561 Button A: X+11, Y+52 -1 562 Button B: X+56, Y+22 -1 563 Prize: X=19807, Y=5634 -1 564 -1 565 Button A: X+24, Y+40 -1 566 Button B: X+67, Y+30 -1 567 Prize: X=6816, Y=3520 -1 568 -1 569 Button A: X+99, Y+81 -1 570 Button B: X+97, Y+11 -1 571 Prize: X=14522, Y=7438 -1 572 -1 573 Button A: X+44, Y+29 -1 574 Button B: X+16, Y+35 -1 575 Prize: X=4532, Y=11498 -1 576 -1 577 Button A: X+54, Y+27 -1 578 Button B: X+23, Y+42 -1 579 Prize: X=14547, Y=10613 -1 580 -1 581 Button A: X+70, Y+43 -1 582 Button B: X+13, Y+33 -1 583 Prize: X=16727, Y=1479 -1 584 -1 585 Button A: X+19, Y+53 -1 586 Button B: X+76, Y+35 -1 587 Prize: X=6162, Y=12142 -1 588 -1 589 Button A: X+44, Y+70 -1 590 Button B: X+47, Y+17 -1 591 Prize: X=16784, Y=15030 -1 592 -1 593 Button A: X+37, Y+21 -1 594 Button B: X+16, Y+72 -1 595 Prize: X=2564, Y=1644 -1 596 -1 597 Button A: X+55, Y+15 -1 598 Button B: X+36, Y+63 -1 599 Prize: X=7936, Y=6738 -1 600 -1 601 Button A: X+44, Y+17 -1 602 Button B: X+24, Y+52 -1 603 Prize: X=14152, Y=2836 -1 604 -1 605 Button A: X+31, Y+18 -1 606 Button B: X+23, Y+43 -1 607 Prize: X=538, Y=18851 -1 608 -1 609 Button A: X+40, Y+13 -1 610 Button B: X+13, Y+53 -1 611 Prize: X=2482, Y=7391 -1 612 -1 613 Button A: X+84, Y+29 -1 614 Button B: X+12, Y+61 -1 615 Prize: X=8060, Y=14653 -1 616 -1 617 Button A: X+13, Y+30 -1 618 Button B: X+49, Y+24 -1 619 Prize: X=5132, Y=12200 -1 620 -1 621 Button A: X+18, Y+44 -1 622 Button B: X+68, Y+33 -1 623 Prize: X=3808, Y=4246 -1 624 -1 625 Button A: X+32, Y+52 -1 626 Button B: X+53, Y+24 -1 627 Prize: X=7078, Y=10780 -1 628 -1 629 Button A: X+11, Y+52 -1 630 Button B: X+82, Y+38 -1 631 Prize: X=5349, Y=2758 -1 632 -1 633 Button A: X+50, Y+16 -1 634 Button B: X+31, Y+41 -1 635 Prize: X=4751, Y=2173 -1 636 -1 637 Button A: X+36, Y+13 -1 638 Button B: X+11, Y+56 -1 639 Prize: X=5727, Y=16087 -1 640 -1 641 Button A: X+18, Y+90 -1 642 Button B: X+93, Y+76 -1 643 Prize: X=6861, Y=8242 -1 644 -1 645 Button A: X+42, Y+28 -1 646 Button B: X+40, Y+99 -1 647 Prize: X=6156, Y=7793 -1 648 -1 649 Button A: X+32, Y+95 -1 650 Button B: X+84, Y+12 -1 651 Prize: X=4040, Y=7721 -1 652 -1 653 Button A: X+15, Y+53 -1 654 Button B: X+67, Y+22 -1 655 Prize: X=3852, Y=4385 -1 656 -1 657 Button A: X+73, Y+22 -1 658 Button B: X+17, Y+60 -1 659 Prize: X=12463, Y=7634 -1 660 -1 661 Button A: X+47, Y+21 -1 662 Button B: X+42, Y+92 -1 663 Prize: X=3473, Y=5067 -1 664 -1 665 Button A: X+25, Y+71 -1 666 Button B: X+58, Y+22 -1 667 Prize: X=13586, Y=2782 -1 668 -1 669 Button A: X+16, Y+42 -1 670 Button B: X+68, Y+42 -1 671 Prize: X=5500, Y=1418 -1 672 -1 673 Button A: X+97, Y+90 -1 674 Button B: X+19, Y+91 -1 675 Prize: X=5033, Y=10246 -1 676 -1 677 Button A: X+57, Y+31 -1 678 Button B: X+22, Y+63 -1 679 Prize: X=3855, Y=2709 -1 680 -1 681 Button A: X+33, Y+71 -1 682 Button B: X+60, Y+25 -1 683 Prize: X=5786, Y=11777 -1 684 -1 685 Button A: X+66, Y+55 -1 686 Button B: X+34, Y+99 -1 687 Prize: X=7346, Y=9867 -1 688 -1 689 Button A: X+11, Y+48 -1 690 Button B: X+44, Y+20 -1 691 Prize: X=12299, Y=14760 -1 692 -1 693 Button A: X+33, Y+16 -1 694 Button B: X+37, Y+60 -1 695 Prize: X=4858, Y=5552 -1 696 -1 697 Button A: X+32, Y+46 -1 698 Button B: X+31, Y+14 -1 699 Prize: X=454, Y=8586 -1 700 -1 701 Button A: X+29, Y+12 -1 702 Button B: X+24, Y+49 -1 703 Prize: X=17339, Y=17815 -1 704 -1 705 Button A: X+63, Y+48 -1 706 Button B: X+22, Y+70 -1 707 Prize: X=2724, Y=6228 -1 708 -1 709 Button A: X+37, Y+81 -1 710 Button B: X+66, Y+46 -1 711 Prize: X=6413, Y=5077 -1 712 -1 713 Button A: X+95, Y+63 -1 714 Button B: X+12, Y+56 -1 715 Prize: X=5338, Y=5894 -1 716 -1 717 Button A: X+67, Y+43 -1 718 Button B: X+12, Y+43 -1 719 Prize: X=14331, Y=10454 -1 720 -1 721 Button A: X+95, Y+46 -1 722 Button B: X+33, Y+51 -1 723 Prize: X=1280, Y=970 -1 724 -1 725 Button A: X+41, Y+13 -1 726 Button B: X+37, Y+66 -1 727 Prize: X=14946, Y=2828 -1 728 -1 729 Button A: X+38, Y+87 -1 730 Button B: X+52, Y+36 -1 731 Prize: X=6692, Y=8760 -1 732 -1 733 Button A: X+68, Y+30 -1 734 Button B: X+17, Y+54 -1 735 Prize: X=4171, Y=13544 -1 736 -1 737 Button A: X+98, Y+53 -1 738 Button B: X+31, Y+81 -1 739 Prize: X=8023, Y=7358 -1 740 -1 741 Button A: X+25, Y+39 -1 742 Button B: X+50, Y+25 -1 743 Prize: X=11950, Y=16760 -1 744 -1 745 Button A: X+29, Y+57 -1 746 Button B: X+47, Y+17 -1 747 Prize: X=16869, Y=8959 -1 748 -1 749 Button A: X+14, Y+60 -1 750 Button B: X+74, Y+16 -1 751 Prize: X=4420, Y=11652 -1 752 -1 753 Button A: X+73, Y+33 -1 754 Button B: X+11, Y+28 -1 755 Prize: X=11353, Y=1006 -1 756 -1 757 Button A: X+17, Y+93 -1 758 Button B: X+97, Y+44 -1 759 Prize: X=4434, Y=5764 -1 760 -1 761 Button A: X+65, Y+38 -1 762 Button B: X+14, Y+27 -1 763 Prize: X=8171, Y=15034 -1 764 -1 765 Button A: X+48, Y+15 -1 766 Button B: X+75, Y+88 -1 767 Prize: X=7785, Y=8308 -1 768 -1 769 Button A: X+60, Y+21 -1 770 Button B: X+26, Y+73 -1 771 Prize: X=14588, Y=15227 -1 772 -1 773 Button A: X+16, Y+41 -1 774 Button B: X+25, Y+17 -1 775 Prize: X=16174, Y=8643 -1 776 -1 777 Button A: X+78, Y+83 -1 778 Button B: X+18, Y+95 -1 779 Prize: X=2334, Y=8703 -1 780 -1 781 Button A: X+89, Y+34 -1 782 Button B: X+77, Y+98 -1 783 Prize: X=4954, Y=5116 -1 784 -1 785 Button A: X+13, Y+91 -1 786 Button B: X+89, Y+24 -1 787 Prize: X=5768, Y=8030 -1 788 -1 789 Button A: X+20, Y+91 -1 790 Button B: X+46, Y+37 -1 791 Prize: X=4492, Y=6310 -1 792 -1 793 Button A: X+41, Y+26 -1 794 Button B: X+12, Y+34 -1 795 Prize: X=14523, Y=18506 -1 796 -1 797 Button A: X+61, Y+17 -1 798 Button B: X+22, Y+31 -1 799 Prize: X=2813, Y=2102 -1 800 -1 801 Button A: X+25, Y+66 -1 802 Button B: X+65, Y+29 -1 803 Prize: X=5490, Y=13313 -1 804 -1 805 Button A: X+72, Y+15 -1 806 Button B: X+62, Y+79 -1 807 Prize: X=7812, Y=5196 -1 808 -1 809 Button A: X+50, Y+24 -1 810 Button B: X+21, Y+50 -1 811 Prize: X=11770, Y=10756 -1 812 -1 813 Button A: X+21, Y+61 -1 814 Button B: X+59, Y+25 -1 815 Prize: X=14485, Y=1757 -1 816 -1 817 Button A: X+57, Y+27 -1 818 Button B: X+17, Y+98 -1 819 Prize: X=4721, Y=6104 -1 820 -1 821 Button A: X+52, Y+28 -1 822 Button B: X+34, Y+59 -1 823 Prize: X=18112, Y=2000 -1 824 -1 825 Button A: X+26, Y+15 -1 826 Button B: X+21, Y+43 -1 827 Prize: X=11182, Y=15659 -1 828 -1 829 Button A: X+64, Y+19 -1 830 Button B: X+15, Y+66 -1 831 Prize: X=4656, Y=11592 -1 832 -1 833 Button A: X+11, Y+28 -1 834 Button B: X+68, Y+20 -1 835 Prize: X=14591, Y=6652 -1 836 -1 837 Button A: X+72, Y+34 -1 838 Button B: X+48, Y+80 -1 839 Prize: X=5568, Y=7216 -1 840 -1 841 Button A: X+12, Y+65 -1 842 Button B: X+51, Y+46 -1 843 Prize: X=1113, Y=2575 -1 844 -1 845 Button A: X+89, Y+83 -1 846 Button B: X+16, Y+84 -1 847 Prize: X=8718, Y=9650 -1 848 -1 849 Button A: X+22, Y+48 -1 850 Button B: X+60, Y+20 -1 851 Prize: X=5972, Y=12828 -1 852 -1 853 Button A: X+41, Y+12 -1 854 Button B: X+24, Y+80 -1 855 Prize: X=3172, Y=8080 -1 856 -1 857 Button A: X+26, Y+47 -1 858 Button B: X+38, Y+22 -1 859 Prize: X=13684, Y=9513 -1 860 -1 861 Button A: X+85, Y+49 -1 862 Button B: X+16, Y+79 -1 863 Prize: X=1448, Y=4184 -1 864 -1 865 Button A: X+14, Y+29 -1 866 Button B: X+76, Y+47 -1 867 Prize: X=2894, Y=2461 -1 868 -1 869 Button A: X+32, Y+65 -1 870 Button B: X+43, Y+17 -1 871 Prize: X=957, Y=14381 -1 872 -1 873 Button A: X+13, Y+39 -1 874 Button B: X+91, Y+27 -1 875 Prize: X=9100, Y=3192 -1 876 -1 877 Button A: X+75, Y+44 -1 878 Button B: X+13, Y+34 -1 879 Prize: X=19238, Y=6708 -1 880 -1 881 Button A: X+42, Y+11 -1 882 Button B: X+33, Y+80 -1 883 Prize: X=7223, Y=4144 -1 884 -1 885 Button A: X+82, Y+24 -1 886 Button B: X+20, Y+21 -1 887 Prize: X=6458, Y=2496 -1 888 -1 889 Button A: X+20, Y+92 -1 890 Button B: X+46, Y+14 -1 891 Prize: X=5692, Y=8004 -1 892 -1 893 Button A: X+44, Y+21 -1 894 Button B: X+37, Y+64 -1 895 Prize: X=6377, Y=10820 -1 896 -1 897 Button A: X+13, Y+42 -1 898 Button B: X+44, Y+13 -1 899 Prize: X=8684, Y=9969 -1 900 -1 901 Button A: X+64, Y+27 -1 902 Button B: X+16, Y+56 -1 903 Prize: X=12592, Y=15407 -1 904 -1 905 Button A: X+94, Y+13 -1 906 Button B: X+19, Y+62 -1 907 Prize: X=2049, Y=5805 -1 908 -1 909 Button A: X+28, Y+51 -1 910 Button B: X+59, Y+15 -1 911 Prize: X=4005, Y=2949 -1 912 -1 913 Button A: X+44, Y+74 -1 914 Button B: X+28, Y+12 -1 915 Prize: X=18272, Y=6332 -1 916 -1 917 Button A: X+25, Y+99 -1 918 Button B: X+72, Y+21 -1 919 Prize: X=6586, Y=2838 -1 920 -1 921 Button A: X+50, Y+12 -1 922 Button B: X+25, Y+57 -1 923 Prize: X=650, Y=4076 -1 924 -1 925 Button A: X+11, Y+58 -1 926 Button B: X+88, Y+23 -1 927 Prize: X=1441, Y=542 -1 928 -1 929 Button A: X+81, Y+17 -1 930 Button B: X+11, Y+74 -1 931 Prize: X=5196, Y=12508 -1 932 -1 933 Button A: X+64, Y+26 -1 934 Button B: X+13, Y+63 -1 935 Prize: X=12867, Y=2773 -1 936 -1 937 Button A: X+40, Y+68 -1 938 Button B: X+54, Y+22 -1 939 Prize: X=19338, Y=12234 -1 940 -1 941 Button A: X+97, Y+31 -1 942 Button B: X+20, Y+30 -1 943 Prize: X=10064, Y=4562 -1 944 -1 945 Button A: X+22, Y+65 -1 946 Button B: X+90, Y+76 -1 947 Prize: X=5604, Y=6682 -1 948 -1 949 Button A: X+75, Y+80 -1 950 Button B: X+92, Y+15 -1 951 Prize: X=6476, Y=4580 -1 952 -1 953 Button A: X+45, Y+12 -1 954 Button B: X+21, Y+58 -1 955 Prize: X=2196, Y=4044 -1 956 -1 957 Button A: X+56, Y+78 -1 958 Button B: X+88, Y+13 -1 959 Prize: X=6000, Y=2002 -1 960 -1 961 Button A: X+17, Y+28 -1 962 Button B: X+43, Y+19 -1 963 Prize: X=9932, Y=4000 -1 964 -1 965 Button A: X+61, Y+17 -1 966 Button B: X+69, Y+94 -1 967 Prize: X=11610, Y=10264 -1 968 -1 969 Button A: X+12, Y+37 -1 970 Button B: X+64, Y+22 -1 971 Prize: X=6588, Y=2721 -1 972 -1 973 Button A: X+33, Y+84 -1 974 Button B: X+43, Y+25 -1 975 Prize: X=5751, Y=7038 -1 976 -1 977 Button A: X+42, Y+13 -1 978 Button B: X+32, Y+53 -1 979 Prize: X=402, Y=15288 -1 980 -1 981 Button A: X+80, Y+36 -1 982 Button B: X+35, Y+64 -1 983 Prize: X=4240, Y=6540 -1 984 -1 985 Button A: X+11, Y+75 -1 986 Button B: X+88, Y+75 -1 987 Prize: X=6094, Y=7950 -1 988 -1 989 Button A: X+24, Y+65 -1 990 Button B: X+38, Y+23 -1 991 Prize: X=2426, Y=4093 -1 992 -1 993 Button A: X+60, Y+26 -1 994 Button B: X+44, Y+84 -1 995 Prize: X=3528, Y=4256 -1 996 -1 997 Button A: X+21, Y+48 -1 998 Button B: X+45, Y+24 -1 999 Prize: X=18347, Y=4784 -1 1000 -1 1001 Button A: X+59, Y+61 -1 1002 Button B: X+11, Y+47 -1 1003 Prize: X=6475, Y=8939 -1 1004 -1 1005 Button A: X+82, Y+76 -1 1006 Button B: X+18, Y+61 -1 1007 Prize: X=6948, Y=9010 -1 1008 -1 1009 Button A: X+50, Y+32 -1 1010 Button B: X+21, Y+45 -1 1011 Prize: X=4510, Y=13786 -1 1012 -1 1013 Button A: X+35, Y+18 -1 1014 Button B: X+21, Y+61 -1 1015 Prize: X=1960, Y=4773 -1 1016 -1 1017 Button A: X+13, Y+67 -1 1018 Button B: X+75, Y+25 -1 1019 Prize: X=851, Y=509 -1 1020 -1 1021 Button A: X+17, Y+60 -1 1022 Button B: X+60, Y+16 -1 1023 Prize: X=11777, Y=14204 -1 1024 -1 1025 Button A: X+95, Y+41 -1 1026 Button B: X+29, Y+68 -1 1027 Prize: X=1467, Y=1077 -1 1028 -1 1029 Button A: X+37, Y+15 -1 1030 Button B: X+21, Y+37 -1 1031 Prize: X=11942, Y=17050 -1 1032 -1 1033 Button A: X+50, Y+87 -1 1034 Button B: X+78, Y+28 -1 1035 Prize: X=5870, Y=8598 -1 1036 -1 1037 Button A: X+66, Y+25 -1 1038 Button B: X+21, Y+52 -1 1039 Prize: X=15023, Y=10182 -1 1040 -1 1041 Button A: X+47, Y+16 -1 1042 Button B: X+25, Y+51 -1 1043 Prize: X=11410, Y=4058 -1 1044 -1 1045 Button A: X+13, Y+28 -1 1046 Button B: X+29, Y+17 -1 1047 Prize: X=7100, Y=9518 -1 1048 -1 1049 Button A: X+56, Y+73 -1 1050 Button B: X+50, Y+19 -1 1051 Prize: X=5558, Y=5629 -1 1052 -1 1053 Button A: X+20, Y+11 -1 1054 Button B: X+12, Y+49 -1 1055 Prize: X=6664, Y=5586 -1 1056 -1 1057 Button A: X+52, Y+22 -1 1058 Button B: X+35, Y+66 -1 1059 Prize: X=15518, Y=1178 -1 1060 -1 1061 Button A: X+64, Y+26 -1 1062 Button B: X+14, Y+39 -1 1063 Prize: X=19550, Y=12353 -1 1064 -1 1065 Button A: X+32, Y+76 -1 1066 Button B: X+44, Y+14 -1 1067 Prize: X=3472, Y=12360 -1 1068 -1 1069 Button A: X+18, Y+54 -1 1070 Button B: X+45, Y+21 -1 1071 Prize: X=6758, Y=12890 -1 1072 -1 1073 Button A: X+24, Y+65 -1 1074 Button B: X+70, Y+28 -1 1075 Prize: X=12308, Y=3512 -1 1076 -1 1077 Button A: X+12, Y+52 -1 1078 Button B: X+47, Y+31 -1 1079 Prize: X=1826, Y=2042 -1 1080 -1 1081 Button A: X+52, Y+27 -1 1082 Button B: X+14, Y+79 -1 1083 Prize: X=3276, Y=3566 -1 1084 -1 1085 Button A: X+14, Y+37 -1 1086 Button B: X+52, Y+28 -1 1087 Prize: X=984, Y=1930 -1 1088 -1 1089 Button A: X+28, Y+59 -1 1090 Button B: X+65, Y+28 -1 1091 Prize: X=5328, Y=4689 -1 1092 -1 1093 Button A: X+49, Y+76 -1 1094 Button B: X+28, Y+13 -1 1095 Prize: X=1652, Y=2471 -1 1096 -1 1097 Button A: X+60, Y+15 -1 1098 Button B: X+34, Y+81 -1 1099 Prize: X=8882, Y=13163 -1 1100 -1 1101 Button A: X+23, Y+36 -1 1102 Button B: X+69, Y+16 -1 1103 Prize: X=7590, Y=4060 -1 1104 -1 1105 Button A: X+52, Y+23 -1 1106 Button B: X+21, Y+56 -1 1107 Prize: X=13723, Y=17067 -1 1108 -1 1109 Button A: X+69, Y+49 -1 1110 Button B: X+12, Y+29 -1 1111 Prize: X=6017, Y=17808 -1 1112 -1 1113 Button A: X+70, Y+34 -1 1114 Button B: X+27, Y+60 -1 1115 Prize: X=12167, Y=1082 -1 1116 -1 1117 Button A: X+48, Y+20 -1 1118 Button B: X+14, Y+57 -1 1119 Prize: X=15880, Y=3036 -1 1120 -1 1121 Button A: X+48, Y+27 -1 1122 Button B: X+22, Y+48 -1 1123 Prize: X=17050, Y=18680 -1 1124 -1 1125 Button A: X+79, Y+26 -1 1126 Button B: X+14, Y+69 -1 1127 Prize: X=17574, Y=11732 -1 1128 -1 1129 Button A: X+69, Y+31 -1 1130 Button B: X+23, Y+56 -1 1131 Prize: X=12060, Y=5392 -1 1132 -1 1133 Button A: X+72, Y+30 -1 1134 Button B: X+12, Y+52 -1 1135 Prize: X=17708, Y=8116 -1 1136 -1 1137 Button A: X+50, Y+58 -1 1138 Button B: X+92, Y+12 -1 1139 Prize: X=6106, Y=3010 -1 1140 -1 1141 Button A: X+34, Y+12 -1 1142 Button B: X+30, Y+60 -1 1143 Prize: X=4324, Y=12032 -1 1144 -1 1145 Button A: X+42, Y+25 -1 1146 Button B: X+19, Y+83 -1 1147 Prize: X=1705, Y=5388 -1 1148 -1 1149 Button A: X+55, Y+31 -1 1150 Button B: X+28, Y+53 -1 1151 Prize: X=5059, Y=10879 -1 1152 -1 1153 Button A: X+68, Y+39 -1 1154 Button B: X+16, Y+32 -1 1155 Prize: X=9704, Y=5358 -1 1156 -1 1157 Button A: X+19, Y+56 -1 1158 Button B: X+58, Y+20 -1 1159 Prize: X=2026, Y=19704 -1 1160 -1 1161 Button A: X+11, Y+36 -1 1162 Button B: X+67, Y+23 -1 1163 Prize: X=10970, Y=4058 -1 1164 -1 1165 Button A: X+80, Y+57 -1 1166 Button B: X+14, Y+34 -1 1167 Prize: X=8256, Y=9160 -1 1168 -1 1169 Button A: X+27, Y+59 -1 1170 Button B: X+55, Y+17 -1 1171 Prize: X=17060, Y=8336 -1 1172 -1 1173 Button A: X+23, Y+55 -1 1174 Button B: X+63, Y+35 -1 1175 Prize: X=8700, Y=11980 -1 1176 -1 1177 Button A: X+39, Y+19 -1 1178 Button B: X+13, Y+37 -1 1179 Prize: X=3760, Y=9512 -1 1180 -1 1181 Button A: X+13, Y+46 -1 1182 Button B: X+53, Y+15 -1 1183 Prize: X=12692, Y=15703 -1 1184 -1 1185 Button A: X+35, Y+21 -1 1186 Button B: X+12, Y+23 -1 1187 Prize: X=17330, Y=16607 -1 1188 -1 1189 Button A: X+92, Y+31 -1 1190 Button B: X+35, Y+53 -1 1191 Prize: X=9507, Y=6706 -1 1192 -1 1193 Button A: X+63, Y+38 -1 1194 Button B: X+12, Y+39 -1 1195 Prize: X=11420, Y=6622 -1 1196 -1 1197 Button A: X+19, Y+89 -1 1198 Button B: X+88, Y+66 -1 1199 Prize: X=9975, Y=13835 -1 1200 -1 1201 Button A: X+11, Y+17 -1 1202 Button B: X+34, Y+15 -1 1203 Prize: X=12659, Y=13151 -1 1204 -1 1205 Button A: X+15, Y+81 -1 1206 Button B: X+35, Y+32 -1 1207 Prize: X=4145, Y=9509 -1 1208 -1 1209 Button A: X+75, Y+17 -1 1210 Button B: X+14, Y+76 -1 1211 Prize: X=14391, Y=8499 -1 1212 -1 1213 Button A: X+35, Y+14 -1 1214 Button B: X+43, Y+63 -1 1215 Prize: X=6138, Y=12933 -1 1216 -1 1217 Button A: X+42, Y+21 -1 1218 Button B: X+24, Y+58 -1 1219 Prize: X=6458, Y=16895 -1 1220 -1 1221 Button A: X+15, Y+73 -1 1222 Button B: X+73, Y+13 -1 1223 Prize: X=10485, Y=16589 -1 1224 -1 1225 Button A: X+74, Y+25 -1 1226 Button B: X+32, Y+67 -1 1227 Prize: X=5598, Y=7173 -1 1228 -1 1229 Button A: X+16, Y+29 -1 1230 Button B: X+29, Y+17 -1 1231 Prize: X=3733, Y=4649 -1 1232 -1 1233 Button A: X+25, Y+67 -1 1234 Button B: X+56, Y+24 -1 1235 Prize: X=10163, Y=7249 -1 1236 -1 1237 Button A: X+11, Y+22 -1 1238 Button B: X+41, Y+21 -1 1239 Prize: X=17426, Y=18474 -1 1240 -1 1241 Button A: X+16, Y+68 -1 1242 Button B: X+87, Y+57 -1 1243 Prize: X=3042, Y=3546 -1 1244 -1 1245 Button A: X+23, Y+56 -1 1246 Button B: X+46, Y+25 -1 1247 Prize: X=11163, Y=15816 -1 1248 -1 1249 Button A: X+38, Y+22 -1 1250 Button B: X+11, Y+39 -1 1251 Prize: X=1010, Y=18450 -1 1252 -1 1253 Button A: X+26, Y+79 -1 1254 Button B: X+59, Y+15 -1 1255 Prize: X=16657, Y=993 -1 1256 -1 1257 Button A: X+43, Y+26 -1 1258 Button B: X+15, Y+45 -1 1259 Prize: X=11157, Y=9529 -1 1260 -1 1261 Button A: X+25, Y+18 -1 1262 Button B: X+36, Y+83 -1 1263 Prize: X=1738, Y=3135 -1 1264 -1 1265 Button A: X+90, Y+13 -1 1266 Button B: X+54, Y+86 -1 1267 Prize: X=7182, Y=3618 -1 1268 -1 1269 Button A: X+95, Y+57 -1 1270 Button B: X+28, Y+83 -1 1271 Prize: X=10654, Y=9570 -1 1272 -1 1273 Button A: X+40, Y+25 -1 1274 Button B: X+21, Y+40 -1 1275 Prize: X=8555, Y=18625 -1 1276 -1 1277 Button A: X+32, Y+13 -1 1278 Button B: X+11, Y+46 -1 1279 Prize: X=9870, Y=2101
diff --git a/2024/13/solution.rs b/2024/13/solution.rs
@@ -0,0 +1,66 @@ -1 1 #[path = "../lib.rs"] -1 2 mod lib; -1 3 -1 4 fn part1(ax: i64, ay: i64, bx: i64, by: i64, cx: i64, cy: i64) -> i64 { -1 5 // a * ax + b * bx = cx -1 6 // a * ay + b * by = cy -1 7 -1 8 // solve for a and b after eleminating the other: -1 9 // a = (cx * by - cy * bx) / (ax * by - ay * bx) -1 10 // b = (cy * ax - cx * ay) / (ax * by - ay * bx) -1 11 -1 12 let v = ax * by - ay * bx; -1 13 let va = cx * by - cy * bx; -1 14 let vb = cy * ax - cx * ay; -1 15 -1 16 if v == 0 { -1 17 // a and b are linear dependent -1 18 // doesn't happen in the puzzle data -1 19 unreachable!(); -1 20 } else if va % v == 0 && vb % v == 0 { -1 21 // there is only one unique solution -1 22 // the "find the cheapest option" is a red herring -1 23 let a = va / v; -1 24 let b = vb / v; -1 25 return a * 3 + b; -1 26 } else { -1 27 // there is no solution -1 28 return 0; -1 29 } -1 30 } -1 31 -1 32 fn main() { -1 33 let mut sum1 = 0; -1 34 let mut sum2 = 0; -1 35 -1 36 let mut ax = 0; -1 37 let mut ay = 0; -1 38 let mut bx = 0; -1 39 let mut by = 0; -1 40 -1 41 for line in lib::iter_input() { -1 42 if let Some((label, values)) = line.split_once(": ") { -1 43 let (sx, sy) = values.split_once(", ").unwrap(); -1 44 let vx = sx[2..].parse::<i64>().unwrap(); -1 45 let vy = sy[2..].parse::<i64>().unwrap(); -1 46 match label { -1 47 "Button A" => { -1 48 ax = vx; -1 49 ay = vy; -1 50 }, -1 51 "Button B" => { -1 52 bx = vx; -1 53 by = vy; -1 54 }, -1 55 "Prize" => { -1 56 sum1 += part1(ax, ay, bx, by, vx, vy); -1 57 sum2 += part1(ax, ay, bx, by, 10_000_000_000_000 + vx, 10_000_000_000_000 + vy); -1 58 }, -1 59 _ => unreachable!(), -1 60 }; -1 61 } -1 62 } -1 63 -1 64 println!("part1: {}", sum1); -1 65 println!("part2: {}", sum2); -1 66 }
diff --git a/2024/13/test.txt b/2024/13/test.txt
@@ -0,0 +1,15 @@ -1 1 Button A: X+94, Y+34 -1 2 Button B: X+22, Y+67 -1 3 Prize: X=8400, Y=5400 -1 4 -1 5 Button A: X+26, Y+66 -1 6 Button B: X+67, Y+21 -1 7 Prize: X=12748, Y=12176 -1 8 -1 9 Button A: X+17, Y+86 -1 10 Button B: X+84, Y+37 -1 11 Prize: X=7870, Y=6450 -1 12 -1 13 Button A: X+69, Y+23 -1 14 Button B: X+27, Y+71 -1 15 Prize: X=18641, Y=10279