【尼姆博弈】POJ2234

题目链接:http://poj.org/problem?id=2234

Bouton定理:先手能够在非平衡尼姆博弈中取胜,而后手能够在平衡的尼姆博弈中取胜。

#include<iostream>
using namespace std;
int main()
{
	int n;
	while(cin>>n)
	{
		int ans=0,a;
		for(int i=1;i<=n;i++)
		{
			cin>>a;
			ans^=a;
		}
		if(ans==0)
			cout<<"No"<<endl;
		else
			cout<<"Yes"<<endl;
	}
	return 0;
}

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章