first attempt, answer too low
parent
e37329ec31
commit
1030b26b31
|
|
@ -0,0 +1,20 @@
|
|||
input = open("input.txt", "r").read().splitlines()
|
||||
|
||||
pos = 50
|
||||
password = 0
|
||||
|
||||
for line in input:
|
||||
if line.startswith('L'):
|
||||
pos -= int(line[1:])
|
||||
elif line.startswith('R'):
|
||||
pos += int(line[1:])
|
||||
|
||||
if pos < 0:
|
||||
pos += 100
|
||||
elif pos > 99:
|
||||
pos -= 100
|
||||
|
||||
if pos == 0:
|
||||
password += 1
|
||||
|
||||
print(password)
|
||||
Loading…
Reference in New Issue