【CF简单介绍】

提交链接:http://codeforces.com/contest/560/problem/A

题面:

A. Currency System in Geraldion
time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

output

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?

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 numbersa1, 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
5
1 2 3 4 5
Output
-1

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

解题:看有无1,没有1是绝对得不到1的。能够直接扫一遍,做一个标记,看1是否出现过。Hack了一个。他遇到1就停止输入,然而我却Hack失败了,由于系统仅仅判out文件....

【打CF,学算法——一星级】Codeforces Round #313 (Div. 2) A. 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. 【cf比赛记录】Codeforces Round #601 (Div. 2)

    Codeforces Round #601 (Div. 2) ---- 比赛传送门 周二晚因为身体不适鸽了,补题补题 A // http://codeforces.com/contest/1255/p ...

  4. 【cf比赛记录】Codeforces Round #600 (Div. 2)

    Codeforces Round #600 (Div. 2) ---- 比赛传送门 昨晚成绩还好,AC A,B题,还能上分(到底有多菜) 补了C.D题,因为昨晚对C.D题已经有想法了,所以补起题来也快 ...

  5. 【打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 ...

  6. 【打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 ...

  7. 【cf比赛记录】Codeforces Round #606 (Div. 2, based on Technocup 2020 Elimination Round 4)

    比赛传送门 只能说当晚状态不佳吧,有点头疼感冒的症状.也跟脑子没转过来有关系,A题最后一步爆搜没能立即想出来,B题搜索没有用好STL,C题也因为前面两题弄崩了心态,最后,果然掉分了. A:简单数学 B ...

  8. Codeforces Round #313 (Div. 1)

    官方英文题解:http://codeforces.com/blog/entry/19237 Problem A: 题目大意: 给出内角和均为120°的六边形的六条边长(均为正整数),求最多能划分成多少 ...

  9. 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的网格,让你 ...

随机推荐

  1. 为图片添加文字 canvas

    <!DOCTYPE html><html><head><meta http-equiv="Content-Type" content=&q ...

  2. js汉字转拼音首字母

    js汉字转拼音首字母 2018-04-09 阅读 1018 收藏 1 原链:segmentfault.com 分享到:   前端必备图书<JavaScript设计模式与开发实践> > ...

  3. bzoj 2115 [Wc2011] Xor 路径最大异或和 线性基

    题目链接 题意 给定一个 \(n(n\le 50000)\) 个点 \(m(m\le 100000)\) 条边的无向图,每条边上有一个权值.请你求一条从 \(1\)到\(n\)的路径,使得路径上的边的 ...

  4. google搜索打不开?提供 国内几个给力的服务器

    http://203.208.46.145/ 这是北京的机器,快到飞起来. http://74.125.224.232/, 屡试不爽 用编辑器打开C:\WINDOWS\system32\drivers ...

  5. gtest 自动化测试 部署

    1.部署 a)编译框架 1.1下载gtest库1.6.0 并解压到文件夹 "/user/{user}/gtest.1.6.0" 下载地址:https://code.google.c ...

  6. MySQL复制表结构和内容到另一张表(转)

    MySQL不要看它小,一个开源的产物,要学习它的东西真的很多.而它的一切是SQL Server无法比拟的. 复制表结构及数据到新表 create table 新表 select * from 旧表 只 ...

  7. 人生中的那口井 z

    有两个和尚住在隔壁,每天都会在同一时间下山去溪边挑水,不知不觉己经过了五年. 突然有一天,左边这座山的和尚没有下山挑水,过了一个星期,还是没有下山挑水. 直到过了一个月,右边那座山的和尚很担心就去探望 ...

  8. quick-coco2d下的事件

    qucik下的事件机制很简洁,也很简单,能够处理大多数的自定义时间,我们新建一个类型,然后用扩展的方式实现事件,之前quick的文档上很详细,但是很悲哀,傻逼的的网站现在是404,记下来,怕到时候忘记 ...

  9. [CentOS]怎样解决gcc版本号冲突?

    今天碰到一个比較坑爹的问题.在centos上用yum安装编译环境,执行: yum -y install make gcc gcc-c++ kernel-devel m4 ncurses-devel o ...

  10. 国家商用password(五)基于SM2的软件授权码生成及校验

    将公开密钥算法作为软件注冊算法的优点是Cracker非常难通过跟踪验证算法得到注冊机.以下.将介绍使用SM2国密算法进行软件注冊的方法. 生成授权码 选择SM2椭圆曲线參数(P,a,b,N,Gx,Gy ...