传送门

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=0,f=1;
    while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
    while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
    return x*f;
}
int n,a;
int main(){
    //freopen("in","r",stdin);
    while(scanf("%d",&n)!=EOF){
        int sg=0,flag=0;
        for(int i=1;i<=n;i++) a=read(),sg^=a,flag|=a>1;
        if( (sg==0 && !flag) || (sg!=0 && flag) ) puts("Yes");
        else puts("No");
    }
}

 

相关文章:

  • 2021-10-31
  • 2022-12-23
  • 2021-12-14
  • 2022-12-23
  • 2021-07-30
猜你喜欢
  • 2021-07-03
  • 2021-07-25
  • 2021-08-24
  • 2021-12-12
  • 2021-05-24
  • 2022-01-23
  • 2021-11-11
相关资源
相似解决方案