Skip to content

Instantly share code, notes, and snippets.

@keithrozario
Last active February 21, 2025 00:26
Show Gist options
  • Save keithrozario/a5f10493fe9fa40773b64c1085fcf9e7 to your computer and use it in GitHub Desktop.
Save keithrozario/a5f10493fe9fa40773b64c1085fcf9e7 to your computer and use it in GitHub Desktop.
Question 13: Advent of Code
prize_x, prize_y = 8400, 5400
a_x, a_y = 94, 34
b_x, b_y = 22, 67
token_counts = []
for a_pushes in 100:
for b_pushes in 100:
if a_pushes * a_x + b_pushes * b_x == prize_x:
if a_pushes * a_y + b_pushes * b_y == prize_y:
token_count = 3 * a_pushes + 1 * b_pushes
token_counts.append(token_count)
min_tokens = min(token_counts)
print(f"The minimum number of tokens is {min_tokens}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment