HDUphp
\(Multi-SG\)模板題ios
#include<iostream> #include<cstdio> 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 SG(int x) { if(x%4==0)return x-1; if(x%4==1)return x; if(x%4==2)return x; if(x%4==3)return x+1; } int main() { int T=read(); while(T--) { int n=read(),s=0; while(n--)s^=SG(read()); puts(s?"Alice":"Bob"); } return 0; }