博弈,跟明明给的教程一样,对于全为1的异或和为0的先手必赢,否则不为0的先手必赢
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
const int NN = 310 , MM = 310;
int n,m,t,q;
int N,M,T;
class TT {
public:
TT()
{
cin>>T;
while(T--)
{
int f=0;
int flag=0;
cin>>N;
for(int i=1;i<=N;i++)
{
scanf("%d",&M);
f=f^M;
if(M!=1)flag=1;
}
if(flag)
{
if(f)cout<<"John\n";
else cout<<"Brother\n";
}
else
{
if(f)cout<<"Brother\n";
else cout<<"John\n";
}
}
}
}g;
int main()
{
return 0;
}