1 条题解

  • 0
    @ 2025-12-26 20:37:22
    #include<bits/stdc++.h>
    using namespace std;
    const int N=110;
    int a[N];
    void solve()
    {
    	int n,sum=0;cin>>n;
    	for(int i=1;i<=n;i++)cin>>a[i],sum^=a[i];
    	int bk=1;for(int i=1;i<=n;i++)if(a[i]>1){bk=0;break;}
    	if(bk){cout<<(n&1?"Brother":"John")<<'\n';return ;}
    	sum?cout<<"John\n":cout<<"Brother\n";
    }
    int main()
    {
    	int t;cin>>t;
    	while(t--)solve();
    	return 0;
    }
    • 1

    G58_4*【博弈论】[SHOI2008] 小约翰的游戏

    信息

    ID
    2675
    时间
    1000ms
    内存
    128MiB
    难度
    3
    标签
    递交数
    23
    已通过
    18
    上传者