DHistory
[Baekjoon] Greedy - 16435 스네이크버드 본문
문제
16435번: 스네이크버드
첫 번째 줄에 과일의 개수 N (1 ≤ N ≤ 1,000) 과 스네이크버드의 초기 길이 정수 L (1 ≤ L ≤ 10,000) 이 주어집니다. 두 번째 줄에는 정수 h1, h2, ..., hN (1 ≤ hi ≤ 10,000) 이 주어집니다.
www.acmicpc.net
풀이
n, l = map(int, input().split())
heights = list(map(int, input().split()))[:n]
def solution(l, heights):
heights.sort()
for height in heights:
if l >= height:
l += 1
return l
print(solution(l, heights))
채점 결과
'Computer Science > Algorithm' 카테고리의 다른 글
[Baekjoon] Greedy - 1417 국회의원 선거 (0) | 2023.08.14 |
---|---|
[Baekjoon] Greedy - 15904 UCPC는 무엇의 약자일까? (0) | 2023.08.13 |
[Baekjoon] Greedy - 1343 폴리오미노 (0) | 2023.08.11 |
[Baekjoon] Greedy - 14916 거스름돈 (0) | 2023.08.11 |
[Baekjoon] Greedy - 1439 뒤집기 (0) | 2023.08.11 |