ZOJ 3113 Anti-SG

来源:互联网 发布:淘宝店导航装修视频 编辑:程序博客网 时间:2024/06/06 21:56

与ZOJ 2507一样

#include <set>#include <cmath>#include <queue>#include <stack>#include <string>#include <cstdio>#include <cstring>#include <algorithm>using namespace std;typedef  long long LL;const double PI = acos(-1.0);template <class T> inline  T MAX(T a, T b){if (a > b) return a;return b;}template <class T> inline  T MIN(T a, T b){if (a < b) return a;return b;}const int N = 111;const int M = 11111;const LL MOD = 1000000007LL;const int dir[4][2] = {1, 0, -1, 0, 0, -1, 0, 1};const int INF = 0x3f3f3f3f;int main(){    int T;    scanf("%d", &T);    while (T--)    {        int temp = 0, n, ans, a;        ans = 0;        scanf("%d", &n);        for (int i = 0; i < n; ++i)        {            scanf("%d", &a);            if (a >= 2)            {                temp = 1;            }            ans ^= a;        }        if ((ans == 0 && temp == 0) || ((ans != 0) && (temp == 1)))                printf("John\n");            else printf("Brother\n");    }    return 0;}


 

原创粉丝点击