Logo
(追記) (追記ここまで)

29900번 - No Change 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB100555056.818%

문제

Jack has $N$ coins, with values $M_1,ドル $M_2,ドル \dots, $M_N$. Find the smallest positive amount that cannot be paid with these coins with no change.

입력

The first line contains $N$ (1ドル \le N \le 1,000円$), the number of coins. The second line contains $N$ integers $M_i$ (1ドル \le M_i \le 1,000円,000円$), the values of the coins.

출력

The only line should contain a single positive integer: the smallest amount that Jack cannot pay with his coins.

제한

예제 입력 1

3
1 2 5

예제 출력 1

4

These coins can be used to pay the amounts 1ドル,ドル 2ドル,ドル and 3ドル = 1 + 2,ドル but it's not possible to pay the amount 4ドル$ exactly.

예제 입력 2

3
1 2 2

예제 출력 2

6

These coins can be used to pay any amount from 1ドル$ to 5ドル,ドル but there's just not enough money to pay the amount 6ドル$.

힌트

출처

Olympiad > Estonian Informatics Olympiad > 2020-21 > Final Round 1번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /