Home [TIL] 99클럽 코테 스터디 6기 9일차 TIL - [그리디] 저울
Post
Cancel

[TIL] 99클럽 코테 스터디 6기 9일차 TIL - [그리디] 저울

오늘의 문제

2437. 저울(골드2)

키워드

그리디, 정렬

나의 풀이

1
2
3
4
5
6
7
8
9
10
11
12
13
N = int(input())
weights = list(map(int, input().split()))
weights.sort()

sum_weight = 0
for i in range(N) :
    if sum_weight + 1 >= weights[i] :
        sum_weight += weights[i]
        
    else :
        break

print(sum_weight+1)

회고

This post is licensed under CC BY 4.0 by the author.

[TIL] 99클럽 코테 스터디 6기 8일차 TIL - [정규표현식] 한국이 그리울 땐 서버에 접속하지

-

Comments powered by Disqus.

Comments powered by Disqus.