您的位置:首页 > 其它

CodeForces - 560A Currency System in Geraldion

2016-07-23 19:20 399 查看
题目大意:货币系统,给出金额大小,输出这些金额不能表示的数中最小的数,可以用任意张。

解题思路:找不到更水的题了……若金额里有 1,则所有数都能表示,输出 -1,若没有 1,则 1 最小输出 1。

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctype.h>
using namespace std;
int str[10000];
int main() {
int n, tag = 0;
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%d", &str[i]);
if (str[i] == 1) tag = 1;
}
if (tag) printf("-1\n");
else printf("1\n");
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  codeforces