# 임무: 2명 선발해서 공부하기 + 능력치 최소화
# 항상 최소만 뽑는다면 => 능력치 최소화
import heapq
def solution(ability, number):
heapq.heapify(ability)
for _ in range(number):
new_ability = heapq.heappop(ability) + heapq.heappop(ability)
heapq.heappush(ability, new_ability)
heapq.heappush(ability, new_ability)
return sum(ability)
'백준 & 프로그래머스' 카테고리의 다른 글
프로그래머스.[PCCP 기출문제] 2번 / 석유 시추.python (0) | 2023.12.11 |
---|---|
[PCCP 모의고사 #2] 3번 - 카페 확장.python (0) | 2023.12.04 |
프로그래머스 [PCCP 모의고사 #2] 1번 - 실습용 로봇.python (1) | 2023.12.03 |
프로그래머스.[PCCP 모의고사 1] 4번.python (0) | 2023.12.02 |
[PCCP 모의고사 #1] 3번 - 유전법칙 (0) | 2023.11.30 |
댓글