【BZOJ1022】[SHOI2008]小约翰的游戏John【Anti-Nim】

来源:互联网 发布:淘宝 饰品店 利润 编辑:程序博客网 时间:2024/06/02 14:33

【题目链接】

传说中的anti-nim...

orz【dzy的blog】

/* Footprints In The Blood Soaked Snow */#include <cstdio>inline int iread() {int f = 1, x = 0; char ch = getchar();for(; ch < '0' || ch > '9'; ch = getchar()) f = ch == '-' ? -1 : 1;for(; ch >= '0' && ch <= '9'; ch = getchar()) x = x * 10 + ch - '0';return f * x;}int main() {for(int T = iread(); T; T--) {int n = iread(), s1 = 0, s2 = 0;for(int i = 1; i <= n; i++) {int x = iread();s1 ^= x; s2 += x > 1;}if((s1 && s2) || (!s1 && !s2)) printf("John\n");else printf("Brother\n");}return 0;}


0 0
原创粉丝点击