1 /* 2 HDU1850 Being a Good Boy in Spring Festival 3 http://acm.hdu.edu.cn/showproblem.php?pid=1850 4 博弈论 尼姆博弈 5 6 7 尼姆博弈:异或和为0则先手必败,否则先手必胜 8 * 9 * 10 */ 11 #include <cstdio> 12 #include <cmath> 13 using namespace std; 14 const int Nmax=105; 15 int num[Nmax]; 16 int main() 17 { 18 int n; 19 while(scanf("%d",&n)&&n) 20 { 21 int sum=0; 22 for(int i=1;i<=n;i++) 23 { 24 scanf("%d",&num[i]); 25 sum^=num[i]; 26 } 27 if(sum==0) 28 printf("0 "); 29 else 30 { 31 int ans=0; 32 for(int i=1;i<=n;i++) 33 { 34 int a=sum^num[i]; 35 if(a<=num[i]) 36 ans++; 37 } 38 printf("%d ",ans); 39 } 40 } 41 return 0; 42 }