This commit is contained in:
basicbonobo 2023-12-06 06:46:48 +01:00
parent a612669e19
commit 8d59da0c79
2 changed files with 2 additions and 2 deletions

View File

@ -5,7 +5,7 @@ from useful import *
ts, ds = [numbers(l) for l in lines(open(0))]
def wins(t, d):
return sum(i*(t-i) > d for i in range(t))
return t + 1 - 2 * next(dropwhile(lambda i: i*(t-i) <= d, range(t)))
print(np.prod([wins(t, d) for (t, d) in zip(ts, ds)]))
print(wins(*[int(''.join(str(el) for el in ar)) for ar in (ts, ds)]))

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python3
from functools import cache, reduce
from itertools import chain, permutations, product, combinations, pairwise, groupby, takewhile
from itertools import chain, dropwhile, permutations, product, combinations, pairwise, groupby, takewhile
from more_itertools import batched, collapse, sliding_window
from collections import defaultdict, deque
import re, sys