aoc2023/d06/part1.py

30 lines
308 B
Python
Raw Normal View History

2023-12-06 09:01:43 +00:00
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)