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. 【转】解决Delphi WebBrowser 无法调用当前浏览器的版本

    procedure TregedtIE.FormCreate(Sender: TObject);   begin     WriteAppNameToReg;     WebBrowser1.Navi ...

  2. Hibernate的关联映射

    单向N-1关联 <many-to-one> 单向N-1关系,比如多个人对应同一个住址,只需要从人实体端找到对应的住址实体,无须关系某个地址的全部住户.程序在N的一端增加一个属性,该属性引用 ...

  3. Mark Down 尝试

    Hello World iawriter sublime text

  4. usr类库的使用(一般用在第三方类库使用系统库报错头文件找不到时)

    第三方Html解析类库Hpple,在导入框架libxml2.2.dylib后,XCode仍然找不到<libxml/tree.h>. 1 .项目 -Targets 中的 Build P ha ...

  5. python 拾贝

    1. 内建的 type() 函数带三个参数时, 将作为强悍的动态类构造器. 如下:   type(name, bases, dict) 返回一个新的type对象. 基本上是 class 语句的动态形式 ...

  6. 微信web开发者工具

    http://mp.weixin.qq.com/wiki/10/e5f772f4521da17fa0d7304f68b97d7e.html#.E4.B8.8B.E8.BD.BD.E5.9C.B0.E5 ...

  7. python之socket

    一.初识socket      socket 是网络连接端点,每个socket都被绑定到一个特定的IP地址和端口.IP地址是一个由4个数组成的序列,这4个数均是范围 0~255中的值(例如,     ...

  8. UE4 使用UGM制作血条

    声明:本文是自己做的项目,可能不是最好的方法,或有错误使用方式.各位不喜勿喷! HP进度 HP背景 将上面的资源拖到UE4中(使用UE4自带的颜色也可实现效果,具体参考官方教程 https://doc ...

  9. PDO操作数据库

  10. kali4.0 下tftpd-hpa服务无法启动的解决方案

    一.前情提要: OS:Kali4.0 64bit 使用以下命令启动tftpd-hpa服务失败: sudo /etc/init.d/tftpd-hpa 二.解决方案: 1.输入以下命令: sudo in ...