[Python/2016] Move solutions into .py files
This commit is contained in:
parent
0269ad8fc3
commit
2514b1d11f
50 changed files with 1172 additions and 3386 deletions
35
Python/2016/15.py
Normal file
35
Python/2016/15.py
Normal file
|
@ -0,0 +1,35 @@
|
|||
from lib import *
|
||||
|
||||
input = read_input(2016, 15)
|
||||
|
||||
discs = []
|
||||
|
||||
for line in input.splitlines():
|
||||
words = line.split()
|
||||
discs.append((int(words[3]), int(words[-1][:-1])))
|
||||
|
||||
|
||||
def test(t):
|
||||
return all((t + x + i + 1) % n == 0 for i, (n, x) in enumerate(discs))
|
||||
|
||||
|
||||
t = 0
|
||||
|
||||
while not test(t):
|
||||
t += 1
|
||||
|
||||
print(t)
|
||||
|
||||
|
||||
discs = []
|
||||
for line in input.splitlines():
|
||||
words = line.split()
|
||||
discs.append((int(words[3]), int(words[-1][:-1])))
|
||||
|
||||
discs.append((11, 0))
|
||||
|
||||
t = 0
|
||||
while not test(t):
|
||||
t += 1
|
||||
|
||||
print(t)
|
Loading…
Add table
Add a link
Reference in a new issue