nim变形题,要求是第一种有多少种胜法,其实就是求去掉某一堆里的一些牌,后手有没有必输测量,也就是异或为0
/* author:jxy lang:C/C++ university:China,Xidian University **If you need to reprint,please indicate the source** */ #include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> #include <algorithm> using namespace std; int org[101]; int main() { int n; while(~scanf("%d",&n)&&n) { int i,ans=0,temp=0; for(i=0;i<n;i++) { scanf("%d",&org[i]); temp^=org[i]; } for(i=0;i<n;i++) { if(org[i]>(temp^org[i]))ans++; } printf("%d\n",ans); } }