fix: 2024/day13/part1

This commit is contained in:
Starnakin 2024-12-13 11:12:23 +01:00
parent 345a5bfccb
commit dd7eae1ba6

View File

@ -13,7 +13,7 @@ exp: str = r"Button A: X([+-]\d+), Y([+-]\d+)\nButton B: X([+-]\d+), Y([+-]\d+)\
def resolv(Ax, Ay, Bx, By, goal_x, goal_y): def resolv(Ax, Ay, Bx, By, goal_x, goal_y):
for press_b in range(101): for press_b in range(101):
press_a = (goal_x - (press_b * Bx)) / Ax press_a = (goal_x - (press_b * Bx)) / Ax
if press_a * Ay + press_b * By > goal_y: if press_a * Ay + press_b * By != goal_y:
continue continue
if (press_a // 1 != press_a): if (press_a // 1 != press_a):
continue continue