"Play CF, learn algorithm--one star" Codeforces Round #313 (Div. 2) A. Currency System in Geraldion

Source: Internet
Author: User

"CF Brief Introduction"

Submit Link: Http://codeforces.com/contest/560/problem/A


Surface:

A. Currency System in Geraldiontime limit per test2 secondsmemory limit per test256 megabytesinputstandard Inputoutputstan Dard output

A Magic Island Geraldion, where Gerald lives, have its own currency system. It uses banknotes of several values. But the problem is, the system isn't perfect and sometimes it happens that Geraldionians cannot express a certain sum of Money with any set of banknotes. Of course, they can use any number of banknotes for each value. Such sum is calledunfortunate. Gerald Wondered:what is the minimumunfortunate sum?

Input

The first line contains number n (1?≤? N. ≤?1000)-the number of values of the banknotes that used in geraldion.

The second line contains n distinct space-separated numbersa1,? A2,?...,? An (1?≤? ) Ai? ≤?106)-the values of the banknotes.

Output

Print a single line-the minimum unfortunate sum. If There is no unfortunate sums, print?-? 1.

Sample Test (s) Input
51 2 3) 4 5
Output
-1

















--------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------

Problem solving: See if there is No 1, No 1 is absolutely not 1. Be able to sweep through, make a mark, see whether 1 has appeared. Hack had one. He encountered 1 to stop typing, but I hack failed, because the system only to award out files ....





"Play CF, learn algorithm--one star" Codeforces Round #313 (Div. 2) A. Currency System in Geraldion

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.