有n堆各若干个物品,两个人轮流从某一堆取任意多的物品,规定每次至少取一个,多者不限,最后取光者得胜.
任何奇异局势(a1, a2, … , an)都有a1(+)a2(+)…(+)an=0. ( (+)为 按位与)
#include <iostream> #include<cstdio> using namespace std; int main() { int n,m,sum; while(~scanf("%d",&n)) { for(int i=0; i<n; i++) { scanf("%d",&m); if(i<1) sum=m; else sum=sum^m; } if(sum) cout<<"Yes"<<endl; else cout<<"No"<<endl; } return 0; }