forked from SharmaManish/Spoj
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMMMGAME.cpp
More file actions
42 lines (29 loc) · 815 Bytes
/
MMMGAME.cpp
File metadata and controls
42 lines (29 loc) · 815 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
int n;
scanf("%d",&n);
while(n--)
{
int s;
scanf("%d",&s);
int x;
int r=0;
bool flag=1;
for(int i=0;i<s;i++)
{
scanf("%d",&x);
r=r^x;
if(x!=1)
flag=0;
}
if(flag)
puts(r==0?"John":"Brother");
else
puts(r!=0?"John":"Brother");
}
system ("pause");
return 0;
}