[Python/2016] Move solutions into .py files

This commit is contained in:
Felix Bargfeldt 2023-10-29 12:38:12 +01:00
parent 0269ad8fc3
commit 2514b1d11f
Signed by: Defelo
GPG key ID: 2A05272471204DD3
50 changed files with 1172 additions and 3386 deletions

35
Python/2016/15.py Normal file
View 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)