【打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的网格,让你 ...
随机推荐
- 【Visual Studio】解决错误 fatal error C1010: unexpected end of file while looking for precompiled head(转)
原文转自 http://blog.csdn.net/liuqiyao_01/article/details/38867145 在编译VS时候,出现fatal error C1010: unexpect ...
- libsm6 & libgtk lost (QQ + WPS: Ubuntu)
error while loading shared libraries: libgtk-x11-2.0.so.0: cannot openshared object file: No such fi ...
- ZOJ 3593.One Person Game-扩展欧几里得(exgcd)
智障了,智障了,水一水博客. 本来是个水题,但是for循环遍历那里写挫了... One Person Game Time Limit: 2 Seconds Memory Limit: 655 ...
- 根据CPU核数合理设置线程池大小
一般来说池中总线程数是核心池线程数量两倍,只要确保当核心池有线程停止时,核心池外能有线程进入核心池即可. 我们所需要关心的主要是核心池线程的数量该如何设置. 自定义线程池代码 package com. ...
- Scaling the Messages Application Back End 【转】
11年的blog. Facebook Messages seamlessly integrates many communication channels: email, SMS, Facebook ...
- 维生素d
作者:卓正内科李爽 链接:https://www.guokr.com/article/440438/来源:果壳本文版权属于果壳网(guokr.com),禁止转载.如有需要,请联系sns@guokr.c ...
- luogu P1314 聪明的质监员
题目描述 小T 是一名质量监督员,最近负责检验一批矿产的质量.这批矿产共有 n 个矿石,从 1到n 逐一编号,每个矿石都有自己的重量 wi 以及价值vi .检验矿产的流程是: 1 .给定m 个区间[L ...
- nginx 启动,重启,添加开机启动等相关命令
nginx -t 测试 配置文件是否正确,同时可以查看配置文件路径 nginx -c /usr/local/nginx/conf/nginx.conf 启动nginx ps -ef|grep ng ...
- jmeter3.x的jtx文件解析
jtl保存测试结果 打开jtl文件,内容为下: timeStamp,elapsed,label,responseCode,responseMessage,threadName,dataType,suc ...
- HDU 1041 Computer Transformation 数学DP题解
本题假设编程是使用DP思想直接打表就能够了. 假设是找规律就须要数学思维了. 规律就是看这些连续的0是从哪里来的. 我找到的规律是:1经过两次裂变之后就会产生一个00: 00经过两次裂变之后也会产生新 ...