본문 바로가기
💻 하나씩 차곡차곡/프로그래머스 (Python)

[프로그래머스/Lv.1/Python] 기능개발

by 뚜루리 2024. 1. 15.
728x90
320x100
import math
def solution(progresses, speeds):
    answer = []
    workDay = []
    for i in range(len(progresses)):
        leftPercent = 100 - progresses[i] # 남은 완성률
        days = math.ceil(leftPercent / speeds[i]) # 작업일
        workDay.append(days)

    for i in range(len(workDay)):
        if i != 0 :
            if workDay[i] < workDay[i-1]:
                workDay[i] = workDay[i-1]

    tmp = list(dict.fromkeys(workDay))
    for i in tmp :
        answer.append(workDay.count(i))

    return answer
728x90
320x100