现在的位置: 首页 > 综合 > 正文

【poj3480】John

2018年01月13日 ⁄ 综合 ⁄ 共 312字 ⁄ 字号 评论关闭
#include<cstdio>
#include<cstring>
#include<iostream>
using namespace std;
int n,t,s;
int main(){
	scanf("%d",&t);
	for(int i=1;i<=t;i++){
		scanf("%d",&n);
		int sum=0;bool flag=false;
		for(int j=1;j<=n;j++){
			scanf("%d",&s);
			sum^=s;
			if(s>1)flag=true;
		}
		if(!flag&&!sum)puts("John");
		else if(flag&&sum)puts("John");
		else puts("Brother");
	}
	return 0;
}

抱歉!评论已关闭.