HDU Be the Winner [Anti-SG]

时间:2023-12-11 09:00:20

传送门

n堆,每次拿走至少一个,剩下的可以分成两堆。最后拿的人输


打表观察发现和Nim游戏一样...裸Anti-SG啊

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
const int N=1e6;
inline int read(){
char c=getchar();int x=,f=;
while(c<''||c>''){if(c=='-')f=-;c=getchar();}
while(c>=''&&c<=''){x=x*+c-'';c=getchar();}
return x*f;
}
int n,a;
int main(){
//freopen("in","r",stdin);
while(scanf("%d",&n)!=EOF){
int sg=,flag=;
for(int i=;i<=n;i++) a=read(),sg^=a,flag|=a>;
if( (sg== && !flag) || (sg!= && flag) ) puts("Yes");
else puts("No");
}
}