[프로그래머스] 스택/큐 - 기능개발(Python3)

kimgaeul02·2023년 1월 5일

프로그래머스

목록 보기
1/11

📄 기능개발

🔗 문제 출처

💻 코드

def solution(progresses, speeds):
    answer = []
    date=[]
    for i in range(len(progresses)):
        tmp=progresses[i]
        cnt=0
        while tmp<100:
            tmp += speeds[i]
            cnt += 1
        date.append(cnt)

    share=date[0]
    count=1
    for i in range(1,len(date)):
        if share>=date[i]:
            count+=1
        else:
            answer.append(count)
            share=date[i]
            count=1
    answer.append(count)
    return answer

👨🏻‍💻 메모

date.append(cnt)를 while문 밖으로 빼지 않아서 출력값이 늘어났습니다. 자잘한 실수가 많은 것 같습니다.

0개의 댓글