standard output

A magic island Geraldion, where Gerald lives, has its own currency system. It uses banknotes of several values. But the problem is, the system is not 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 of each value. Such sum is called unfortunate. 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 numbers a1, a2, ..., an (1 ≤ ai ≤ 106) — the values of the banknotes.

Output

Print a single line — the minimum unfortunate sum. If there are no unfortunate sums, print  - 1.

Sample test(s)
input
51 2 3 4 5
output
-1

地址:http://codeforces.com/contest/560/problem/A

思路:首先题目要看懂,于是就百度翻译了。   然后,本来以为是挺难的,考虑了下就两种情况,有1 没 1.   
#include <cstdio>

using namespace std;

int main(){

        int n;
        int ipt;
        while(scanf("%d", &n) != EOF){
                ;
                ; i < n; i ++){
                        scanf("%d", &ipt);
                         == ipt){
                                flag = ;
                                printf("-1\n");
                        }
                }
                 == flag){
                        printf("1\n");
                }
        }
        ;
}
ps: 个人总结,好久没A题,太懒了。好好加油,每天A一题,从今天开始希望能坚持。                                                                             2015-07-25 18:02:07

Currency System in Geraldion的更多相关文章

  1. Codeforces Round #313 (Div. 2) A. Currency System in Geraldion

    A. Currency System in Geraldion Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/co ...

  2. Codeforces Round #313 (Div. 2) A. Currency System in Geraldion 水题

    A. Currency System in Geraldion Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/c ...

  3. Codeforces Round #313 A Currency System in Geraldion

    A  Currency System in Geraldion Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64 ...

  4. Currency System in Geraldion (Codeforces 560A)

    A  Currency System in Geraldion Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64 ...

  5. 【打CF,学算法——一星级】Codeforces Round #313 (Div. 2) A. Currency System in Geraldion

    [CF简单介绍] 提交链接:http://codeforces.com/contest/560/problem/A 题面: A. Currency System in Geraldion time l ...

  6. Codeforces Round #313 A. Currency System in Geraldion(简单题)

    A. Currency System in Geraldion time limit per test 2 seconds memory limit per test 256 megabytes in ...

  7. 数据结构——Currency System in Geraldion

    题目: Description A magic island Geraldion, where Gerald lives, has its own currency system. It uses b ...

  8. 【63.73%】【codeforces 560A】Currency System in Geraldion

    time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...

  9. Codeforces Round #313 (Div. 2) A.B,C,D,E Currency System in Geraldion Gerald is into Art Gerald's Hexagon Equivalent Strings

    A题,超级大水题,根据有没有1输出-1和1就行了.我沙茶,把%d写成了%n. B题,也水,两个矩形的长和宽分别加一下,剩下的两个取大的那个,看看是否框得下. C题,其实也很简单,题目保证了小三角形是正 ...

随机推荐

  1. fiddler如何修改request header

    在命令行中输入命令:  bpu www.baidu.com   (这种方法只会中断www.baidu.com) 然后刷新网站,在fiddler中点击被打断的网址,点击Inspectors—>Ra ...

  2. POJ 3233 Matrix Power Series(构造矩阵求等比)

    Description Given a n × n matrix A and a positive integer k, find the sum S = A + A2 + A3 + … + Ak. ...

  3. jQuery的deferred对象学习

    #copy { background-color: lightgreen; padding: 15px; margin: 10px } 一.deferred对象简介 deferred对象是jquery ...

  4. 搭建一个简单的svn服务器

    cenos 6.5,svnserver 1.6.11 默认可能已经安装,没有的话就: yum install svn -ysvnserver --version 创建一个svn仓库: svnadmin ...

  5. 渗透杂记-2013-07-13 关于SMB版本的扫描

    smb2的溢出,其实在metasploit里面有两个扫描器可以用,效果都差不多,只是一个判断的更加详细,一个只是粗略的判断. Welcome to the Metasploit Web Console ...

  6. Win8下Visual Studio编译报“无法注册程序集***dll- 拒绝访问。请确保您正在以管理员身份运行应用程序。对注册表项”***“的访问被拒绝。”问题修正(转)

    原来在Win7下Visual Studio跑的好好的程序,现在在Win8下编译报“无法注册程序集***dll- 拒绝访问.请确保您正在以管理员身份运行应用程序.对注册表项”***“的访问被拒绝.”的错 ...

  7. boldSystemFontOfSize 和 systemFontOfSize 的区别

    使用 UIFont 的下列方法: + systemFontOfSize + boldSystemFontOfSize + italicSystemFontOfSize p.p1 { margin: 0 ...

  8. Sublime Text 3 个人开发习惯

    1.添加author.date到函数注释里面 docblockr插件 a.preferences--package settings--docblockr--settings-user点击打开 b.在 ...

  9. MySQL的数据类型

  10. provider 设计模式

    相关介绍文章: Provider Model Design Pattern and Specification, Part 1 (old but detailed). The ASP.NET 2.0 ...