poj1740 A New Stone Game [Game]

There are several heap of stones, and each time the need to take away some of the stones from the pile, and then if desired, and then take some of the stones from the heap (surmise that Italy should not come up with all) is not given to any other empty heap . Negative human inoperable.


Game has not ah. . The feeling is entirely a question of IQ, although the nature or similar looking strategy, starting from a simple model based on the nature, try to expand conclusion, trying to find a stable strategy for the transformation model. He turned the problem of the solution , orzorz. Invasion deleted.

Add on, then if the even pile up a bunch of the shortest par pile, cut a full complement of it, this is the one that is equal to the situation, with the current situation conflicts, it is not possible.

 1 #include<iostream>
 2 #include<cstdio>
 3 #include<cstring>
 4 #include<algorithm>
 5 #include<cmath>
 6 #define dbg(x) cerr << #x << " = " << x <<endl
 7 using namespace std;
 8 typedef long long ll;
 9 typedef double db;
10 typedef pair<int,int> pii;
11 template<typename T>inline T _min(T A,T B){return A<B?A:B;}
12 template<typename T>inline T _max(T A,T B){return A>B?A:B;}
13 template<typename T>inline char MIN(T&A,T B){return A>B?(A=B,1):0;}
14 template<typename T>inline char MAX(T&A,T B){return A<B?(A=B,1):0;}
15 template<typename T>inline void _swap(T&A,T&B){A^=B^=A^=B;}
16 template<typename T>inline T read(T&x){
17     x=0;int f=0;char c;while(!isdigit(c=getchar()))if(c=='-')f=1;
18     while(isdigit(c))x=x*10+(c&15),c=getchar();return f?x=-x:x;
19 }
20 const int N=10000+7;
21 int A[N];
22 int n;
23 
24 int main(){//freopen("test.in","r",stdin);//freopen("test.out","w",stdout);
25     while(read(n)){
26         for(register int i=1;i<=n;++i)read(A[i]);
27         if(n&1)puts("1");
28         else{
29             sort(A+1,A+n+1);register int i;
30             for(i=1;i<=n;i+=2)if(A[i]^A[i+1]){puts("1");break;}
31             if(i>n)puts("0");
32         }
33     }
34     return 0;
35 }

 

Guess you like

Origin www.cnblogs.com/saigyouji-yuyuko/p/11448812.html