Solve task #1.
This commit is contained in:
10
01/input01.txt
Normal file
10
01/input01.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
L68
|
||||
L30
|
||||
R48
|
||||
L5
|
||||
R60
|
||||
L55
|
||||
L1
|
||||
L99
|
||||
R14
|
||||
L82
|
||||
22
01/solve.py
Executable file
22
01/solve.py
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import sys
|
||||
|
||||
position = 50
|
||||
code = 0
|
||||
|
||||
for line in sys.stdin:
|
||||
line = line.strip()
|
||||
if line.startswith('L'):
|
||||
position -= int(line[1:])
|
||||
elif line.startswith('R'):
|
||||
position += int(line[1:])
|
||||
else:
|
||||
raise Exception('weird line')
|
||||
|
||||
position %= 100
|
||||
|
||||
if not position:
|
||||
code += 1
|
||||
|
||||
print(code)
|
||||
Reference in New Issue
Block a user