Considering the process of proving the Bouton theorem, the Nim with n number and (XOR) is X, the highest bit of 1 in the K-bit, then the n number must have a Y in the K is also a 1.
To change the number of Y to x xor y, then the number of N Nim and 0, will be converted to the initiator will be defeated situation.
So how many kinds of the initiator, just see the number of N in how many y, to meet the binary K is a 1.
1#include <cstdio>2 3 Const intMaxh = -;4 Const intMAXN = -+Ten;5 intA[MAXN];6 7 intMain ()8 {9 intN;Ten while(SCANF ("%d", &n) = =1&&N) One { A ints =0; - for(inti =0; I < n; i++) {scanf ("%d", &a[i]); S ^=a[i];} - if(!s) {Puts ("0");Continue; } the inth =0; - for(inti =0; i < maxh; i++)if(S & (1<< i)) H =i; - intCNT =0; - for(inti =0; I < n; i++)if(A[i] & (1<< h)) cnt++; +printf"%d\n", CNT); - } + A return 0; at}
code June
HDU 1850 (number of Nim game winning schemes) Being a good boy in Spring Festival