Time Limit: 1000MS | Memory Limit: 10000K | |
Total Submissions: 7233 | Accepted: 2173 |
Description
Input
Output
Sample Input
2 3 1 2 3 8 1 5 6 7 9 12 14 17
Sample Output
Bob will win Georgia will win
Source
1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 #include <algorithm> 5 6 using namespace std; 7 8 const int MAX_N = 1005; 9 int p[MAX_N]; 10 11 int main() 12 { 13 int t; 14 scanf("%d",&t); 15 while(t--) { 16 int N; 17 scanf("%d",&N); 18 for(int i = 0; i < N; ++i) { 19 scanf("%d",&p[i]); 20 } 21 if(N % 2 == 1) p[N++] = 0; 22 sort(p, p + N); 23 24 int x = 0; 25 for(int i = 0; i + 1 < N; i += 2) { 26 x ^= (p[i + 1] - p[i] - 1); 27 } 28 29 if(x == 0) printf("Bob will win\n"); 30 else printf("Georgia will win\n"); 31 } 32 //cout << "Hello world!" << endl; 33 return 0; 34 }
原文:http://www.cnblogs.com/hyxsolitude/p/3718811.html