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. esponse.sendRedirect方式的转向与RequestDispatcher的forward方法的比较

    esponse.sendRedirect方式的转向与RequestDispatcher的forward方法的比较 JavaWeb开发中,采用MVC模式的时候,在控制器完成模型的调用之后会选择界面对用户 ...

  2. SpringMVC框架下实现JSON(类方法中回传数据到jsp页面,使用jQuery方法回传)

    JSON的实现,即将需要的数据回传到jsp页面: 1>.加入实现Json的三个架包到lib中:2>.目标方法上边加入注解,需要返回的值3>.在jsp页面中书写jQuery方法: ec ...

  3. treeview 控件使用和数据绑定

    一.TreeViewe 是由多个类来定义的,TreeView组件是由命名空间“System.Windows.Froms”中的“TreeView”类来定义的,而其中的节点(即Node),是由命名空间“S ...

  4. Fisher–Yates shuffle 洗牌(shuffle)算法

    今天在敲undersore的源码,数组里面有一个shuffle,把数组随机打乱. _.shuffle = function(obj) { var set = isArrayLike(obj) ? ob ...

  5. Android 网络开发之WIFI

    WIFI就是一种无线联网技术,常见的是使用无线路由器.那么在这个无线路由器的信号覆盖的范围内都可以采用WIFI连接的方式进行联网.如果无线路由器连接了一个ADSL线路或其他的联网线路,则又被称为&qu ...

  6. eclipse 4.5.2 源码修改 格式化Java代码

    注:本文代码基于eclipse4.5.2 1. 需求:在换电脑之后,如何不用配置eclipse就可以很快进入开发呢,并保持原来的编码规范. 2. 方法:修改eclipse源码 分别修改了两个jar包2 ...

  7. TensorFlow白皮书

    TensorFlow [1] is an interface for expressing machine learning algorithms, and an implementation for ...

  8. android Menu

    menu <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="h ...

  9. cocoapods使用一直Updating local specs repositories的解决方案

    pod install 换成pod install --verbose --no-repo-update这个命令,前面的命令被墙了 ,<pre id="best-content-226 ...

  10. CSS3 -webkit-transform

    scale:缩放,1为原始大小.scale(x).正数放大,负数缩小.属性值为一个时,x/y轴同时缩放:属性值为两个值时,分别控制x.y轴的缩放 rotate:水平旋转,属性值格式为Xdeg.(deg ...