Anti−SGAnti−SG游戏定义:
决策集合为空的操作者胜。
其余规则与SGSG游戏一致。
SJ定理:
对于任意一个Anti−SG游戏,如果定义所有子游戏的SG值为0时游戏结束,先手必胜的条件:
游戏的SG值为0且所有子游戏SG值均不超过1。
游戏的SG值不为0且至少一个子游戏SG值超过1。
本题容易看出SG(x)=x
大概证明;portal
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
using namespace std;
#define inf 0x3f3f3f3f
#define ll long long
#define N 60
inline char gc(){
static char buf[1<<16],*S,*T;
if(S==T){T=(S=buf)+fread(buf,1,1<<16,stdin);if(T==S) return EOF;}
return *S++;
}
inline int read(){
int x=0,f=1;char ch=gc();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=gc();}
while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=gc();
return x*f;
}
int main(){
// freopen("a.in","r",stdin);
int tst=read();
while(tst--){
int n=read(),sg=0,flag=0;
while(n--){int x=read();sg^=x;if(x!=1) flag=1;}
if((!sg&&!flag)||(sg&&flag)){puts("John");continue;}
puts("Brother");
}return 0;
}