Solve 2025 day 1 and 2

This commit is contained in:
2025-12-14 10:36:32 -05:00
parent e655580b3f
commit 183f909508
3 changed files with 60 additions and 3 deletions

View File

@@ -1,5 +1,22 @@
from lib import get_data
data = get_data(__file__)
print(data)
NUM = 100
data = get_data(__file__)
pos = 50
r1, r2 = 0, 0
for line in data.splitlines():
d = line[0]
n = int(line[1:])
dir = 1 if d == "R" else -1
for _ in range(n):
pos = (pos + dir) % NUM
if pos == 0:
r2 += 1
if pos == 0:
r1 += 1
print(r1)
print(r2)