【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. 自定义及发布一个webservice服务

    自定义及发布一个webservice服务    - 声明 某个业务服务为webservice服务       通过@webservice 注解来声明    - 发布webservice服务       ...

  2. 多个电脑之间使用相同的ssh密钥

    首先我们给最先创建的密钥的电脑取名为OLD, 给后创建的密钥的电脑取名为NEW,在OLD上创建密钥,文件默认保存在 ~/.ssh/ 中: ssh-keygen –t rsa –C "your ...

  3. 宝宝舌苔发白,消化不好 http://wenwen.soso.com/z/q103192661.htm

    你好,宝宝咳嗽,如果舌苔是白的,则是风寒咳嗽,说明孩子寒重,咳嗽的痰也较稀.白黏,并兼有鼻塞流涕,这时应吃一些温热.化痰止咳的食品.如果孩子的舌苔是黄.红,则是风热咳嗽,说明孩子内热较大,咳嗽的痰黄. ...

  4. hdu 2654(欧拉函数)

    Become A Hero Time Limit: 15000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)To ...

  5. 【Kafka】《Kafka权威指南》——分区partition

    在上篇的例子里([Kafka]<Kafka权威指南>--写数据), ProducerRecord 对象包含了目标主题.键和值. Kafka 的消息是 一个个 键值对, ProducerRe ...

  6. 缺少 Google API 秘钥,因此 Chromium 的部分功能将无法使用

    获取密钥(ID)教程: https://www.chromium.org/developers/how-tos/api-keys 获取密钥(ID)地址: https://cloud.google.co ...

  7. JVM中的内存分区简介

    1.JVM的内存区域划分: 大多数 JVM 将内存区域划分为 Method Area(Non-Heap)(方法区) ,Heap(堆) , Program Counter Register(程序计数器) ...

  8. dedecms图片列表效果调用

    效果如图 代码如下: <div class="listbox"> <ul class="e1"> {dede:list pagesize ...

  9. Flutter开发记录part1

    (1)AppBar:automaticallyImplyLeading//是否带返回leading箭头 (2)非route路由页面跳转 :Navigator.of(context).push(Mate ...

  10. CentOS6.5环境配置笔记

    CentOS6.5环境配置笔记 一.概述 服务器系统重装,配置应用运行环境 CentOS6.5 x64 二.修改密码 重新设置登录密码 $passwd 或 $passwd root 三.配置端口号及防 ...