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

22653번 - Strange Currency System 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
8 초 (추가 시간 없음) 512 MB17151090.909%

문제

The currency system in the Kingdom of Yoax-Musty is strange and fairly inefficient. Like other countries, the kingdom has its own currencty unit denoted by K \$ (kingdom dollar). However, the Ministry of Finance issues bills for every value between 1 K \$ and (231 - 1) K \$ worth.

On the other hand, this system often enables people to make many different values just with a small number of bills. For example, if you have four bills of 1 K \,ドル 2 K \,ドル 4 K \,ドル and 8 K \$ worth respectively, you can make any values from 1 K #36; to 15 K \$.

In this problem, you are requested to write a program that finds the minimum value that cannot be made with a given set (multiset in a mathematical sense) of bills. For the case with the four bills (1 K \,ドル 2 K \,ドル 4 K \,ドル and 8 K \$), since you can make any values up to 15 K \,ドル your program should report 16 K $.

입력

The input consists of two lines. The first line contains an integer N (1 ≤ N ≤ 10000), the number of bills. The second line contains N integers, each of which represents the value of a bill in K \$. There may be multiple bills of the same value.

출력

Print the minimum value unable to be made on a line. The value should be given in K \$ and without any currency sign or name.

제한

예제 입력 1

4
1 2 4 8

예제 출력 1

16

예제 입력 2

5
1 1 3 11 2

예제 출력 2

8

힌트

출처

Contest > ICPC Japanese Alumni Group > JAG Winter Camp > JAG Winter Camp 2009 Day 3 I번

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

출처

대학교 대회

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

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