Currency System in Geraldion
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?
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.
Print a single line — the minimum unfortunate sum. If there are no unfortunate sums, print - 1.
51 2 3 4 5
-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的更多相关文章
- 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 ...
- 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 ...
- Codeforces Round #313 A Currency System in Geraldion
A Currency System in Geraldion Time Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64 ...
- Currency System in Geraldion (Codeforces 560A)
A Currency System in Geraldion Time Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64 ...
- 【打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 ...
- 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 ...
- 数据结构——Currency System in Geraldion
题目: Description A magic island Geraldion, where Gerald lives, has its own currency system. It uses b ...
- 【63.73%】【codeforces 560A】Currency System in Geraldion
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...
- 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题,其实也很简单,题目保证了小三角形是正 ...
随机推荐
- angular 后台交换实例
<!DOCTYPE html><html lang="en" ng-app="myApp"><head> <meta ...
- 一个ubuntu phper的自我修养(lamp)
lamp环境搭建出坑记 lamp虽然大家都懂,但是还是要解释一下先,要做的是一个狭义的解释,以对应我们即将搭建的环境. L指linux(ubuntu). A指apache(apache2). M指my ...
- 【转】UML类图与类的关系详解
UML类图与类的关系详解 2011-04-21 来源:网络 在画类图的时候,理清类和类之间的关系是重点.类的关系有泛化(Generalization).实现(Realization).依赖(D ...
- 深入了解try catch
@Test public void testWeiXin(){ System.out.println(task()); } private boolean task(){ try { int i = ...
- IOS JSON
//请求数据 dispatch_async(dispatch_get_global_queue(, ), ^{ _dataArray=[NSMutableArray array]; NSString ...
- python两种生成md5的方法
一. 使用md5包 import md5 src = 'this is a md5 test.' m1 = md5.new() m1.update(src) print m1.hexdigest() ...
- 物联网应用中实时定位与轨迹回放的解决方案 – Redis的典型运用(转载)
物联网应用中实时定位与轨迹回放的解决方案 – Redis的典型运用(转载) 2015年11月14日| by: nbboy| Category: 系统设计, 缓存设计, 高性能系统 摘要 ...
- 读《编写可维护的JavaScript》第六章总结
第六章 避免使用全局变量 JavaScript执行环境在很多方面都有其独特之处,全局变量就是其中之一.“全局变量”是一个神秘的对象,它表示了脚本的最外层上下文. 在浏览器中,windows对象往往重载 ...
- Sprint(第十二天11.25)
- Linux解读
Linux中权限(r.w.x)对于目录与文件的意义 一.权限对于目录的意义 1.首先要明白的是目录主要的内容是记录文件名列表和子目录列表,而不是实际存放数据的地方. 2.r权限:拥有此权限表示可以读取 ...