| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 1024 MB | 106 | 61 | 56 | 59.574% |
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.
3 1 2 5
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.
3 1 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번