본문 바로가기

알고리즘/프로그래머스

[Python] 기능 개발

https://school.programmers.co.kr/learn/courses/30/lessons/42586

 

프로그래머스

코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.

programmers.co.kr

# 기능 개발

def solution(progresses, speeds):
    import math
    need_days = [] # 각 기능 개발까지 필요한 날짜

    for x, y in zip(progresses, speeds):
        need_day = math.ceil((100 - x) / y)
        need_days.append(need_day)

    answer = []
    threshold = need_days[0]
    cnt = 0
    for i in range(0, len(need_days)):
        if threshold >= need_days[i]:
            cnt += 1
        else:
            answer.append(cnt)
            cnt = 1
            threshold = need_days[i]
            
    answer.append(cnt)
    return answer

'알고리즘 > 프로그래머스' 카테고리의 다른 글

[Python] n^2 배열 자르기  (0) 2022.12.20
[Python] 최고의 집합  (1) 2022.12.19
[Python] 이중 우선순위 큐  (0) 2022.12.09
[Python] 정수 삼각형  (0) 2022.12.08
[Python] 위장  (0) 2022.12.07