Created
July 26, 2013 03:37
-
-
Save NonWhite/6085953 to your computer and use it in GitHub Desktop.
SPOJ 3969 [MMMGAME]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <sstream> | |
| #include <bitset> | |
| #include <cstdio> | |
| #include <string> | |
| #include <cstring> | |
| #include <vector> | |
| #include <queue> | |
| #include <stack> | |
| #include <set> | |
| #include <map> | |
| #include <algorithm> | |
| #include <cmath> | |
| #include <cstdlib> | |
| #include <cctype> | |
| #include <numeric> | |
| #include <list> | |
| #define FOR(i,A) for(typeof (A).begin() i = (A).begin() ; i != (A).end() ; i++) | |
| #define mp make_pair | |
| #define debug( x ) cout << #x << " = " << x << endl | |
| #define clr(v,x) memset( v, x , sizeof v ) | |
| #define all(x) (x).begin() , (x).end() | |
| #define rall(x) (x).rbegin() , (x).rend() | |
| #define ones(x) __builtin_popcount( x ) | |
| #define f(i,a,b) for(int i = a ; i < b ; i++) | |
| #define fd(i,a,b) for(int i = a ; i >= b ; i--) | |
| #define PI acos( -1.0 ) | |
| #define EPS 1E-9 | |
| #define TAM 110 | |
| using namespace std; | |
| typedef pair<int,int> ii ; | |
| typedef long long ll ; | |
| typedef long double ld ; | |
| typedef pair<int,ii> pii ; | |
| int n ; | |
| int v[ TAM ] ; | |
| int main(){ | |
| int test ; | |
| scanf("%d" , &test ) ; | |
| while( test-- ){ | |
| scanf("%d" , &n ) ; | |
| int cont = 0 ; | |
| f( i , 0 , n ) scanf("%d" , &v[ i ] ) , cont += ( v[ i ] == 1 ) ; | |
| if( cont == n ){ | |
| if( cont & 1 ) printf("Brother\n" ) ; | |
| else printf("John\n" ) ; | |
| }else{ | |
| f( i , 1 , n ) v[ 0 ] ^= v[ i ] ; | |
| if( v[ 0 ] ) printf("John\n" ) ; | |
| else printf("Brother\n" ) ; | |
| } | |
| } | |
| return 0 ; | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment