aoc2023/d06/part1.py

30 lines
308 B
Python

SAMPLE = [
#Time: Distance:
(7, 9),
(15, 40),
(30, 200),
]
INPUT = [
(40, 219),
(81, 1012),
(77, 1365),
(72, 1089),
]
L = SAMPLE
L=INPUT
R = 1
for (t,r) in L: # time, record
S = 0
for i in range(t): # hold for i
v = i # speed in m/s
d = v * (t-i)
if d > r:
S += 1
print(S)
R *= S
print(R)