[Python/2017] Move solutions into .py files
This commit is contained in:
parent
fbc5fda60f
commit
7b1efc0d9c
51 changed files with 1100 additions and 4546 deletions
32
Python/2017/05.py
Normal file
32
Python/2017/05.py
Normal file
|
@ -0,0 +1,32 @@
|
|||
from lib import *
|
||||
|
||||
input = read_input(2017, 5)
|
||||
|
||||
lines = input.splitlines()
|
||||
|
||||
|
||||
jumps = [*map(int, lines)]
|
||||
pos = 0
|
||||
i = 0
|
||||
while pos in range(len(jumps)):
|
||||
p = pos
|
||||
pos += jumps[pos]
|
||||
jumps[p] += 1
|
||||
i += 1
|
||||
|
||||
print(i)
|
||||
|
||||
|
||||
jumps = [*map(int, lines)]
|
||||
pos = 0
|
||||
i = 0
|
||||
while pos in range(len(jumps)):
|
||||
p = pos
|
||||
pos += jumps[pos]
|
||||
if jumps[p] >= 3:
|
||||
jumps[p] -= 1
|
||||
else:
|
||||
jumps[p] += 1
|
||||
i += 1
|
||||
|
||||
print(i)
|
Loading…
Add table
Add a link
Reference in a new issue