/*
对于任意一个 Anti-SG 游戏,如果我们规定当局面中所有的单一游戏的SG 值为0 时,游戏结束。
则先手必胜当且仅当:
(1)游戏的 SG 函数不为0且游戏中某个单一游戏的SG函数大于1;
(2)游戏的 SG 函数为 0 且游戏中没有单一游戏的SG函数大于1;
anti-nim游戏,取完石子的人失败
*/
#include <iostream>
using namespace std;
int main()
{
int t;
cin >> t;
while( t-- )
{
int n,flag = 0;
int res = 0;
cin >> n;
for (int i = 0; i < n; i++)
{
int x;
cin >> x;
if( x > 1 ) flag = 1;
res ^= x;
}
if( flag && res ) cout << "John" << endl;
else if( flag == 0 && res == 0 ) cout << "John" << endl;
else cout << "Brother" << endl;
}
return 0;
}
anti-SG 游戏
最新推荐文章于 2021-11-11 16:47:58 发布