标签:
题目链接:http://acm.swust.edu.cn/problem/0234/
2
1 1
2
1 2
-1
|
3
4
|
1 #include <iostream> 2 using namespace std; 3 int a[5], vis[301]; 4 int main(){ 5 int n, i; 6 while (cin >> n, n != -1){ 7 memset(vis, 0, sizeof(vis)); 8 for (i = 1; i <= n; i++){ 9 cin >> a[i]; 10 vis[a[i]] = 1; 11 } 12 if (n == 2){ 13 vis[a[1] + a[2]] = 1; 14 } 15 else{ 16 vis[a[1] + a[2]] = 1; 17 vis[a[2] + a[3]] = 1; 18 vis[a[1] + a[3]] = 1; 19 vis[a[1] + a[2] + a[3]] = 1; 20 } 21 for (i = 1;; i++) 22 if (!vis[i]) { 23 cout << i << endl; 24 break; 25 } 26 } 27 return 0; 28 }
其实多简单的,就是题意太坑了有木有~~~
[Swust OJ 234]--IrreducibleNumber(题意太坑)
标签:
原文地址:http://www.cnblogs.com/zyxStar/p/4581827.html