문제
링크텍스트
풀이
결과
def f_t(id_t):
if id_t == 0:
progresses, speeds, r = [93, 30, 55], [1, 30, 5], [2, 1]
elif id_t == 1:
progresses, speeds, r = [95, 90, 99, 99, 80, 99], [1, 1, 1, 1, 1, 1], [1, 3, 2]
elif id_t == 2:
progresses, speeds, r = [95, 95, 95, 95], [4, 3, 2, 1], [2, 1, 1]
return progresses, speeds, r
from math import ceil
def solution(progresses, speeds):
n = len(progresses)
i = 0
d = [ceil((100 - progresses[i])/speeds[i])]
p = [1]
for i in range(1,n):
di = ceil((100 - progresses[i])/speeds[i])
if di <= d[i-1]:
di = d[i-1]
p[-1] += 1
else:
p.append(1)
d.append(di)
return p
for id_t in range(3):
progresses, speeds, r = f_t(id_t)
a = solution(progresses, speeds)
print([a,r])