day 6, easy peazy
This commit is contained in:
parent
2ae942085d
commit
69c8d0f72c
|
@ -0,0 +1,30 @@
|
|||
|
||||
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)
|
|
@ -0,0 +1,10 @@
|
|||
import sys
|
||||
|
||||
(t,r) = (int(sys.argv[1]), int(sys.argv[2]))
|
||||
|
||||
print(
|
||||
# i : time of charging, between 0 and t
|
||||
# v = i # speed in m/s
|
||||
# d = v * (t-i) # distance
|
||||
sum(i*(t-i) > r for i in range(t))
|
||||
)
|
Loading…
Reference in New Issue