15.py
1 from lib import * 2 3 input = read_input(2016, 15) 4 5 discs = [] 6 7 for line in input.splitlines(): 8 words = line.split() 9 discs.append((int(words[3]), int(words[-1][:-1]))) 10 11 12 def test(t): 13 return all((t + x + i + 1) % n == 0 for i, (n, x) in enumerate(discs)) 14 15 16 t = 0 17 18 while not test(t): 19 t += 1 20 21 print(t) 22 23 24 discs = [] 25 for line in input.splitlines(): 26 words = line.split() 27 discs.append((int(words[3]), int(words[-1][:-1]))) 28 29 discs.append((11, 0)) 30 31 t = 0 32 while not test(t): 33 t += 1 34 35 print(t)