/// Raihan Ruhin /// CSE, Jahangirnagar University. /// Dhaka-Bangladesh. /// id: raihanruhin (topcoder / codeforces / codechef / hackerrank / uva / uvalive / spoj), 3235 (lightoj) /// mail: raihanruhin@ (yahoo / gmail / facebook) /// blog: ruhinraihan.blogspot.com //#include<bits/stdc++.h> #include<iostream> using namespace std; #define SET(a) memset(a,-1,sizeof(a)) #define CLR(a) memset(a,0,sizeof(a)) #define PI acos(-1.0) #define MOD 1000000007 #define MX 100010 int main() { //ios_base::sync_with_stdio(0);cin.tie(0); int kk=1, tc, n, x; string s; cin>>tc; while(tc--) { cin>>n; int res=0, chk=0; for(int i=0;i<n;i++) { cin>>x; if(x>1) chk=1; res^=x; } //cout<<"Case "<<kk++<<": "<< <<"\n"; if((res && chk) || (!res && !chk)) cout<<"John\n"; else cout<<"Brother\n"; } return 0; }
Tuesday, 31 March 2015
UVA 1566 John (POJ 3480, HDU 1907, ZOJ 3113, UVALive 3830, Regionals 2007 >> Europe - Southeastern)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment