Source: Day 13: Claw Contraption
Full solution for today (spoilers!).
Part 1
Given Button A
(ax, ay)
, Button B(bx, by)
, and Prize(px, py)
; how many times must you press Button A (a
) and Button B (b
) to reach the Prize? Sum3a + b
for each machine that has a solution.