coderforce 560A Currency System in Geraldion
来源:互联网 发布:mrp软件下载基地 编辑:程序博客网 时间:2024/04/29 18:06
题意:如果从这列数中选一些数,可以组成任意数的话,就输出-1,不能的话,就输出最小不能组成的数。
解析:判断这列数中有没有1这个数,如果有的话,就可以组成任意数,输出-1;如果没有,则不能组成任意数,最小的不能组成的数,肯定是1.
#include<stdio.h>#include<string.h>#include<algorithm>using namespace std;int main(){ int n; while(scanf("%d",&n)!=EOF) { int a,ok=0; for(int i=0;i<n;i++) { scanf("%d",&a); if(a==1) { ok=1; } } if(ok) printf("-1\n"); else printf("1\n"); } return 0;}
0 0
- coderforce 560A Currency System in Geraldion
- codeforces 560 A. Currency System in Geraldion
- CodeForces 560A Currency System in Geraldion
- CodeForces 560A Currency System in Geraldion
- codeforce 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
- A. Currency System in Geraldion
- Codeforces 560A Currency System in Geraldion 货币组合
- Codeforces 560 A. Currency System in Geraldion(想法题)
- Code Forces 560 A. 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#313 A. Currency System in Geraldion
- Currency System in Geraldion
- 2015最新最全 Android 谷歌消息推送GCM 详细使用教程
- Gitlab的使用
- 自反,反自反
- tyvj1035棋盘覆盖
- JAVA三星题之connect four
- coderforce 560A Currency System in Geraldion
- 多态的四种不同形式
- 国内开发者汇总
- iOS中 通知中心Text (实例)
- 说说Unity3D里的各种坐标系
- 无法将构造器应用到给定的类型
- 把Tomcat和JSP加入 MAC OS X Server
- 宗教信仰
- 众联BreezeCMS实现思路(三)