16 lines
345 B
Python
Executable File
16 lines
345 B
Python
Executable File
#!/usr/bin/python3
|
|
import sys
|
|
data = [int(l.rstrip()) for l in sys.stdin.readlines()]
|
|
|
|
pos, steps = 0, 0
|
|
while pos >= 0 and pos < len(data):
|
|
if data[pos] < 3:
|
|
data[pos] = data[pos] + 1
|
|
pos = pos + data[pos] - 1
|
|
else:
|
|
data[pos] = data[pos] - 1
|
|
pos = pos + data[pos] + 1
|
|
steps = steps + 1
|
|
|
|
print(steps)
|