Complete day 13, part 1
This commit is contained in:
parent
4bdfb05300
commit
216f590993
|
@ -0,0 +1,2 @@
|
||||||
|
1008833
|
||||||
|
19,x,x,x,x,x,x,x,x,41,x,x,x,x,x,x,x,x,x,643,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,17,13,x,x,x,x,23,x,x,x,x,x,x,x,509,x,x,x,x,x,37,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,29
|
|
@ -0,0 +1,12 @@
|
||||||
|
#!/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
|
Loading…
Reference in New Issue