【打CF,学算法——一星级】Codeforces Round #313 (Div. 2) A. Currency System in Geraldion
提交链接:http://codeforces.com/contest/560/problem/A
题面:
2 seconds
256 megabytes
standard input
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 calledunfortunate. 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 numbersa1, 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.
5
1 2 3 4 5
-1
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
解题:看有无1,没有1是绝对得不到1的。能够直接扫一遍,做一个标记,看1是否出现过。Hack了一个。他遇到1就停止输入,然而我却Hack失败了,由于系统仅仅判out文件....
【打CF,学算法——一星级】Codeforces Round #313 (Div. 2) A. 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 ...
- 【cf比赛记录】Codeforces Round #601 (Div. 2)
Codeforces Round #601 (Div. 2) ---- 比赛传送门 周二晚因为身体不适鸽了,补题补题 A // http://codeforces.com/contest/1255/p ...
- 【cf比赛记录】Codeforces Round #600 (Div. 2)
Codeforces Round #600 (Div. 2) ---- 比赛传送门 昨晚成绩还好,AC A,B题,还能上分(到底有多菜) 补了C.D题,因为昨晚对C.D题已经有想法了,所以补起题来也快 ...
- 【打CF,学算法——三星级】Codeforces Round #313 (Div. 2) C. Gerald's Hexagon
[CF简单介绍] 提交链接:http://codeforces.com/contest/560/problem/C 题面: C. Gerald's Hexagon time limit per tes ...
- 【打CF,学算法——二星级】Codeforces Round #313 (Div. 2) B. Gerald is into Art(水题)
[CF简单介绍] 提交链接:http://codeforces.com/contest/560/problem/B 题面: B. Gerald is into Art time limit per t ...
- 【cf比赛记录】Codeforces Round #606 (Div. 2, based on Technocup 2020 Elimination Round 4)
比赛传送门 只能说当晚状态不佳吧,有点头疼感冒的症状.也跟脑子没转过来有关系,A题最后一步爆搜没能立即想出来,B题搜索没有用好STL,C题也因为前面两题弄崩了心态,最后,果然掉分了. A:简单数学 B ...
- Codeforces Round #313 (Div. 1)
官方英文题解:http://codeforces.com/blog/entry/19237 Problem A: 题目大意: 给出内角和均为120°的六边形的六条边长(均为正整数),求最多能划分成多少 ...
- dp - Codeforces Round #313 (Div. 1) C. Gerald and Giant Chess
Gerald and Giant Chess Problem's Link: http://codeforces.com/contest/559/problem/C Mean: 一个n*m的网格,让你 ...
随机推荐
- 透明层提示框代替windows警告窗口方法!
原文发布时间为:2009-04-05 -- 来源于本人的百度文章 [由搬家工具导入] 有人会说,怎么网页用JavaScript会有安全提示,而其他网站上面用了JavaScript都没有安全提示,呵呵, ...
- [LeetCode] Number of 1 Bits 位操作
Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also know ...
- Spark-RDD之 zip
zip这个函数是在scala中的,spark中也应用于RDD类型 val posLeftRDD = FreqDic1.map(line => line._1) zip sc.paralleliz ...
- [Js]删除数组指定元素
写在前面 在最近的项目中,有用到js对数组的操作,之前自己几乎没有用到这种方法,这里就记录一下,算是对学到的东西的一种总结吧. 数组对象splice方法 splice() 方法向/从数组中添加/删除项 ...
- linux查看端口状态相关命令
netstat netstat 命令应用是比较频繁的,比如查看端口占用啦,查看端口进程啦,这些时候都是有必要的. netstat命令各个参数说明如下: -t : 指明显示TCP端口 -u : 指明显示 ...
- 更换 mac时 开发证书
更换 mac时 开发证书,先导出, 后导入,如果出现错误,把projects自动签名改为手动
- gitbook简单安装和使用
1.gitbook是用来写书的,支持markdown等 2.在线写 gitbook最新版地址:https://www.gitbook.com/account/ 免费用户只能有一个public和一个pr ...
- uiaotumator ui測试 高速调试
1. uiaotumator ui測试 Demo.java package uiautomatorDemo1; import java.io.File; import android.graphics ...
- hduoj1285确定比赛名次
确定比赛名次 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total ...
- 脚本命令加载外部配置文件夹conf
加载log4j配置文件 Log4iConfigurer类 public class Log4iConfigurer { private static boolean INITIALIZED = fal ...