2020-12-13 23:09:39 +01:00
|
|
|
#!/usr/bin/python3
|
2020-12-14 22:02:32 +01:00
|
|
|
import time
|
|
|
|
|
|
|
|
def shuttle_generator():
|
|
|
|
with open("input") as fh:
|
|
|
|
now = int(fh.readline())
|
|
|
|
for i, x in enumerate(fh.readline().split(",")):
|
|
|
|
if x != "x":
|
|
|
|
x = int(x)
|
|
|
|
yield i, x
|
|
|
|
|
|
|
|
shuttle = shuttle_generator()
|
|
|
|
|
|
|
|
def check(t, tests):
|
|
|
|
for i, n in tests:
|
|
|
|
if (t + i) % n != 0:
|
|
|
|
return False
|
|
|
|
return True
|
|
|
|
|
|
|
|
t = 0
|
|
|
|
step = 1
|
|
|
|
n = 1
|
|
|
|
tests = []
|
|
|
|
while True:
|
|
|
|
if check(t, tests):
|
|
|
|
print(t, "matches", tests)
|
|
|
|
time.sleep(2)
|
|
|
|
step *= n
|
|
|
|
i, n = next(shuttle)
|
|
|
|
tests.append((i, n))
|
|
|
|
t += step
|
2020-12-13 23:09:39 +01:00
|
|
|
|