728x90
기본 아이디어
- 현재 날짜에 이미 작업 완료된 프로세스들을 cnt할 방법 -> 아무래도 while문
코드
import math
from collections import deque
def solution(progresses, speeds):
answer = []
days = deque([math.ceil((100 - p) / s) for p, s in zip(progresses, speeds)])
while days:
cur = days.popleft()
cnt = 1
while days and days[0] <= cur:
days.popleft()
cnt += 1
answer.append(cnt)
return answer
- 처음부터 모든 태스크에 필요한 작업일수를 미리 계산해놓고 들어가는 방법
728x90
'Programming > Python' 카테고리의 다른 글
[프로그래머스] 올바른 괄호 (0) | 2025.04.09 |
---|---|
[프로그래머스] 카펫 (0) | 2025.04.09 |
[프로그래머스] 조이스틱 (0) | 2025.04.08 |
[프로그래머스] 소수 찾기 (0) | 2025.04.07 |
[백준] 2606 | 바이러스 (0) | 2025.04.07 |