Codeforces 560 A. Currency System in Geraldion(想法题)
来源:互联网 发布:网络主播毒害中国 编辑:程序博客网 时间:2024/06/06 08:36
题目链接:http://codeforces.com/problemset/problem/560/A
题 意:给你n个数,找出他们不能表示的最小的数。
思 路:1以将任何数表示出来,而除了1本身外,其他数无法表示1;
所以数组中只要有1,则没有无法表示的数,而无1,则1无法表示,最小的即是1.
#include <iostream>using namespace std;#include <string.h>#include <stdio.h>#include <queue>#include <algorithm>int main(){ int n; while( scanf ( "%d", &n ) != EOF ) { int f = 0; for( int i = 0 ;i < n; i ++ ) { int x; scanf ( "%d", &x ); if( x == 1 ) f = 1; } if( !f ) printf("1\n"); else printf("-1\n"); } return 0;}
0 0
- Codeforces 560 A. Currency System in Geraldion(想法题)
- codeforces 560 A. Currency System in Geraldion
- CodeForces 560A Currency System in Geraldion
- CodeForces 560A Currency System in Geraldion
- CodeForces 560A Currency System in Geraldion
- CodeForces 560A Currency System in Geraldion
- CodeForces 560A Currency System in Geraldion
- CodeForces - 560A Currency System in Geraldion
- CodeForces#313 A. Currency System in Geraldion
- Codeforces 560A Currency System in Geraldion 货币组合
- CodeForces 560A-Currency System in Geraldion
- CodeForces 560A Currency System in Geraldion 【水题】
- 【63.73%】【codeforces 560A】Currency System in Geraldion
- Codeforces Round #313 A. Currency System in Geraldion(简单题)
- coderforce 560A Currency System in Geraldion
- codeforce 560 A Currency System in Geraldion
- Code Forces 560 A. Currency System in Geraldion(水~)
- A. Currency System in Geraldion
- 聚类算法
- sqoop的安装与使用
- hdoj 1873 看病要排队(优先队列的运用)
- UIPopoverController中UITableViewController 中selectRowAtIndexPath: animated:scrollPosition滚动不到的解决方法
- CCConfiguration作用
- Codeforces 560 A. Currency System in Geraldion(想法题)
- 自定义控件-仿iphone之ToggleButton&VoiceSeekBar
- GRE写作必备句型
- VS平台上Python开发一些小tips
- Warning:can't find referenced class.
- java过滤微信中Emoji表情
- git和gitHub在Eclipse和AndroidStudio中的使用
- 数据结构浅析(一)
- 在利用session保存回话的时候,怎么保证让关掉浏览器后重新打开回话还在