Revenge of Nim II
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 443 Accepted Submission(s): 157
---Wikipedia
Today, Nim takes revenge on you, again. As you know, the rule of Nim game is rather unfair, only the nim-sum (⊕) of the sizes of the heaps is zero will the first player lose. To ensure the fairness of the game, the second player has a chance to move some (can be zero) heaps before the game starts, but he has to move one heap entirely, i.e. not partially. Of course, he can’t move all heaps out, at least one heap should be left for playing. Will the second player have the chance to win this time?
Each test case begins with an integer N, indicating the number of heaps. Then N integer Ai follows, indicating the number of each heap.
[Technical Specification]
1. 1 <= T <= 100
2. 1 <= N <= 1 000
3. 1 <= Ai <= 1 000 000 000 000
#include
#include
#include
#include
#include
using namespace std;
typedef __int64 ll;
const int MAXN = 1010;
ll a[MAXN];
int n;
int gauss()
{
if(n==1)return 0;
for(int i=0;i40){
printf("Yes\n");
continue;
}
if(gauss())printf("Yes\n");
else printf("No\n");
}
return 0;
}