Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- boj 6443
- 2025 프로그래머스 코딩챌린지 1차예선
- DirectX12
- pcce 기출문제 풀이
- string construction
- ice cream parlor
- c++
- lock based stack
- 지게차와 크레인
- boj 11657
- lock free stack
- 브루트포스
- PCCE
- two characters
- the maximum subarray
- pccp 기출문제 풀이
- making anagrams
- special string again
- LCS
- find the town judge
- the longest increasing subsequence
- DirectX
- boj 1717
- boj 1074
- 프로그래밍공부
- dp
- count triplets
- find the running median
- lock based queue
- 비밀 코드 해독
Archives
- Today
- Total
오구의코딩모험
[Python] 기능개발 본문
반응형
[코딩테스트 고득점 KIT - 스택/큐]
문제 짧게 3줄 요약.
1. 100% 기능 진도를 나가야 서비스에 반영할 수 있음
2. 앞서 개발할 기능을 다 구현 못하면 먼저 개발한 기능이라도 배포 불가능
3. 배포 하루에 한 번, 한 번 배포에 몇 개의 기능씩 반영되는가?
divmod 함수를 이용하여 서비스에 반영하기 위해 몇 일을 더 구현해야하는지
service라는 변수로 계산하여 list에 담는다.
배포해야 할 기능이 1개 남았을 경우,
앞선 기능이 구현되지 않아 뒤의 기능들을 한번에 배포할 경우,
앞의 기능이 구현되어 배포할 경우
3가지로 나누어 구현해주면 된다!
def solution(progresses, speeds):
answer = []
service_list = []
# divmod(a,b) -> [a//b, a%b] 값
for idx,progress in enumerate(progresses):
service = divmod(100-progress,speeds[idx])[0]
if divmod(100-progress,speeds[idx])[1] != 0:
service += 1
service_list.append(service)
cnt = 1
while(len(service_list)>0):
# 배포해야 할 기능이 1개 남았을 경우
if len(service_list) == 1:
answer.append(cnt)
service_list.pop(0)
# 앞선 기능이 구현되지 않은 경우
elif service_list[0] >= service_list[1]:
cnt += 1
service_list.pop(1)
# 배포
elif service_list[0] < service_list[1]:
answer.append(cnt)
cnt = 1
service_list.pop(0)
return answer
반응형
'프로그래밍 공부 > 프로그래머스' 카테고리의 다른 글
[Python] 주차 요금 계산 (0) | 2022.12.29 |
---|---|
머쓱이 스탬프 획득! (0) | 2022.12.27 |
[Python] 올바른 괄호 (0) | 2022.12.24 |
[Python] 같은 숫자는 싫어 (0) | 2022.12.24 |
[Python] 위장 (0) | 2022.12.23 |
Comments