【Luogu2197】NIM游戏(博弈论)

时间:2023-03-09 07:35:37
【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;
}