1022

 

思路:

  nim;

 

代码:

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
    int T;
    scanf("%d",&T);
    while (T--)
    {
        int n;
        scanf("%d",&n);
        int ans=0,pos;
        bool ok=true;
        while(n--)
        {
            scanf("%d",&pos),ans^=pos;
            if(pos!=1) ok=false;
        }
        if ((ok&&!ans)||(!ok&&ans)) printf("John\n");
        else printf("Brother\n");
    }
    return 0;
}

 

相关文章:

  • 2021-07-08
  • 2022-03-01
  • 2021-09-18
  • 2021-09-22
  • 2022-12-23
  • 2021-07-24
  • 2022-01-11
猜你喜欢
  • 2022-02-24
  • 2021-09-08
  • 2021-11-29
  • 2021-08-28
  • 2021-10-04
相关资源
相似解决方案