【Luogu2197】NIM游戏(博弈论)

题面

洛谷

题解

\(Nim\)游戏模板题

#include<iostream>
#include<cstdio>
#include<cstdlib>
using namespace std;
inline int read()
{
	int x=0;bool t=false;char ch=getchar();
	while((ch<'0'||ch>'9')&&ch!='-')ch=getchar();
	if(ch=='-')t=true,ch=getchar();
	while(ch<='9'&&ch>='0')x=x*10+ch-48,ch=getchar();
	return t?-x:x;
}
int main()
{
	int T=read();
	while(T--)
	{
		int n=read(),s=0;
		while(n--)s^=read();
		puts(s?"Yes":"No");
	}
	return 0;
}

posted @ 2018-08-15 20:17  小蒟蒻yyb  阅读(366)  评论(0编辑  收藏  举报