adventofcode-2020/13/part1

13 lines
284 B
Python
Executable File

#!/usr/bin/python3
with open("input") as fh:
now = int(fh.readline())
ids = [int(x) for x in fh.readline().split(",") if x != "x"]
min_dt = now # arbitrary large number
for id in ids:
dt = -now % id
if dt < min_dt:
print(id, dt, id * dt)
min_dt = dt