solved day 1 part 1

bram-benchmarks
Brechtje van Gessel 2025-12-01 09:21:18 +01:00
parent 1030b26b31
commit 0118bf9920
1 changed files with 7 additions and 5 deletions

View File

@ -9,10 +9,12 @@ for line in input:
elif line.startswith('R'):
pos += int(line[1:])
if pos < 0:
pos += 100
elif pos > 99:
pos -= 100
# keep subtracting or adding 100 until position is between 0 and 99
while pos < 0 or pos > 99:
if pos < 0:
pos += 100
elif pos > 99:
pos -= 100
if pos == 0:
password += 1