hdu2509 Be the Winner (尼姆博弈)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2509


#include <stdio.h>

int main()
{
	int n,num,ans,cnt,i;
	while(scanf("%d",&n)!=EOF)
	{
		ans=cnt=0;
		for(i=0;i<n;++i)
		{
			scanf("%d",&num);
			ans^=num;
			if(num>1)
				cnt++;
		}
		if((ans==0&&cnt>1)||(ans!=0&&cnt==0)) 
			printf("No\n");
		else
			printf("Yes\n");
	}
	return 0;
}


你可能感兴趣的:(hdu2509 Be the Winner (尼姆博弈))