题目大意:货币系统,给出金额大小,输出这些金额不能表示的数中最小的数,可以用任意张。
解题思路:找不到更水的题了……若金额里有 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;
}