+/AoC
advent of code
git clone https://git.julia.blue/+/AoC
c5cccc3
master
1from functools import reduce 2from math import ceil ,sqrt 3from operator import mul 4 5quad = lambda a ,b ,c : (- b + sqrt (b ** 2 - 4 * a * c ))/ (2 * a ) 6solve = lambda t ,d :1 + t - 2 * ceil (quad (- 1 ,t ,- d - 1 )) 7 8with open ("input" )as f : 9times = [int (s )for s in f .readline ().split (":" )[- 1 ].split ()] 10dists = [int (s )for s in f .readline ().split (":" )[- 1 ].split ()] 11 12reduce (mul , (solve (* p )for p in zip (times ,dists )))) 13 14time = int ("" .join (map (str ,times ))) 15dist = int ("" .join (map (str ,dists ))) 16solve (time ,dist ))