标签:
Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)
Total Submission(s): 3745 Accepted Submission(s): 2116
#include<stdio.h> #include<string.h> #include<math.h> int a[100]; int main(){ int t; scanf("%d",&t); int n; while(t--){ scanf("%d",&n); bool flag=true; for(int i=1;i<=n;i++){ scanf("%d",&a[i]); if(a[i]!=1) flag=false; } int ans=a[1]; for(int i=2;i<=n;i++) ans=ans^a[i]; if(flag){ if(n%2) printf("Brother\n"); else printf("John\n"); } else{ if(ans) printf("John\n"); else printf("Brother\n"); } } return 0; }
标签:
原文地址:http://www.cnblogs.com/13224ACMer/p/4870199.html