CodeForces - 560A Currency System in Geraldion
2016-07-23 19:20
399 查看
题目大意:货币系统,给出金额大小,输出这些金额不能表示的数中最小的数,可以用任意张。
解题思路:找不到更水的题了……若金额里有 1,则所有数都能表示,输出 -1,若没有 1,则 1 最小输出 1。
解题思路:找不到更水的题了……若金额里有 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 Round #197 (Div. 2)
- Codeforces Round #198 (Div. 1)
- Codeforces 405E Codeforces Round #238 (Div. 2)E
- Codeforces 407C Codeforces Round #239 (Div. 1)C
- CodeForces 449A - Jzzhu and Chocolate
- CodeForces 449 B. Jzzhu and Cities
- codeforces 618C. Constellation
- Codeforces Round #349 (Div. 2) - C
- Codeforces Round #361 (Div. 2)
- 7.13Codeforces Round #360 (Div. 2)
- Codeforces Round #363 (Div. 2)
- Codeforces Round #265 (Div. 2)
- Codeforces #310 div2 C. Case of Matryoshkas
- 状态压缩DP codeforces 244 Problem C. The Brand New Function 和 codeforces 165 E. Compatible Numbers
- codeforces 16 Problem E fish
- Codeforces Round332 部分题解
- CodeForces 603A_Alternative Thinking (DP)
- CodeForces 602B_Approximating a Constant Range_DP
- Codeforces round #247 for Div. 2
- Codeforces Round #246 (Div. 2)