목차

저울

ps
링크acmicpc.net/…
출처BOJ
문제 번호2437
문제명저울
레벨골드 3
분류

그리디

시간복잡도O(nlogn)
인풋사이즈n<=1000
사용한 언어Python
제출기록30864KB / 68ms
최고기록52ms
해결날짜2022/01/31

풀이

코드

"""Solution code for "BOJ 2437. 저울".

- Problem link: https://www.acmicpc.net/problem/2437
- Solution link: http://www.teferi.net/ps/problems/boj/2437

Tags: [Greedy]
"""


def main():
    N = int(input())  # pylint: disable=unused-variable
    weights = [int(x) for x in input().split()]

    weights.sort()
    max_measurable_weight = 0
    for w in sorted(weights):
        if w > max_measurable_weight + 1:
            break
        max_measurable_weight += w

    print(max_measurable_weight + 1)


if __name__ == '__main__':
    main()