solved day 1 part 1
parent
1030b26b31
commit
0118bf9920
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue