bzoj1022: [SHOI2008]小约翰的游戏John
2016-01-06 21:41
344 查看
/article/2649718.html
View Code
#include<cstdio> #include<cstring> #include<cstdlib> #include<algorithm> #include<iostream> using namespace std; void setIO(const string& s) { freopen((s + ".in").c_str(), "r", stdin); freopen((s + ".out").c_str(), "w", stdout); } template<typename Q> Q read(Q& x) { static char c, f; for(f = 0; c = getchar(), !isdigit(c); ) if(c == '-') f = 1; for(x = 0; isdigit(c); c = getchar()) x = x * 10 + c - '0'; if(f) x = -x; return x; } template<typename Q> Q read() { static Q x; read(x); return x; } int main() { #ifdef DEBUG freopen("in.txt", "r", stdin); freopen("out.txt", "w", stdout); #endif int T = read<int>(), x, n, xor_sum, flag; while(T--) { read(n); xor_sum = 0; flag = 1; while(n--) { read(x); if(x ^ 1) flag = 0; xor_sum ^= x; } puts((flag ^ (bool)xor_sum) ? "John" : "Brother"); } return 0; }
View Code
相关文章推荐
- android框架--xUtils
- python之类之select
- Fork使用
- Qt设计界面的初学笔记
- error: symbol(s) not found for architecture x86_64
- 课题:监控视频内的人数统计
- 怎么为WebStorm更换主题 修改字体样式
- makefile--变量的使用(二)
- “顶层const”和“底层const”的思考
- 找回Reshaprer的Alt+Enter快捷键的方法
- 前端开发工具sumlime
- 1010. 一元多项式求导 (25)
- nginx 1.9 支持http2 协议
- 基于iOS,Android的服务器证书失效检测
- RAM
- 构建高可用Linux服务器二
- 数据库表空间
- Linux信号入门详解
- android之旅24 多媒体编程:音乐、视频、拍照、视频
- 实例10:带选择头像的用户注册页面