HDU1907 John
Description
Both of players are using optimal game strategy. John starts first always. You will be given information about M&Ms and your task is to determine a winner of such a beautiful game.
Input
Constraints:
1 <= T <= 474,
1 <= N <= 47,
1 <= Ai <= 4747
Output
Sample Input
3
3 5 1
1
1
Sample Output
Brother
Source
依旧是anti-nim
AC记录喜+1
/*by SilverN*/
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
using namespace std;
int n;
int s;
int main(){
int T;
scanf("%d",&T);
while(T--){
scanf("%d",&n);
bool flag=;
s=;
int i,j;
int a;
for(i=;i<=n;i++){
scanf("%d",&a);
s^=a;
if(a>)flag=;
}
if(flag){
if(s==)printf("Brother\n");
else printf("John\n");
}
else
if(n&)printf("Brother\n");
else printf("John\n"); }
return ;
}
HDU1907 John的更多相关文章
- hdu1907 John 博弈
Little John is playing very funny game with his younger brother. There is one big box filled with M& ...
- 尼姆博弈HDU1907
HDU1907 http://acm.hdu.edu.cn/showproblem.php?pid=1907 两种情况1.当全是1时,要看堆数的奇偶性 2.判断是奇异局势还是非奇异局势 代码: #in ...
- John the ripper使用教程
破解Linux的用户密码:John [跨平台的密码解密工具] root@only:~# unshadow /etc/passwd /etc/shadow > ~/file_to_crack ro ...
- *HDU1907 博弈
John Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)Total Submis ...
- HDU 1907 John nim博弈变形
John Problem Description Little John is playing very funny game with his younger brother. There is ...
- Js-字符串截取substring,分割split,指标indexOf,拼接John
函数:split() 功能:使用一个指定的分隔符把一个字符串分割存储到数组例子: var theString=”jpg|bmp|gif|ico|png”; var arr=theString.spli ...
- John the Ripper
John the RipperJohn the Ripper(简称John)是一款著名的密码破解工具.它主要针对各种Hash加密的密文.它不同于Rainbow Table方式.它采用实时运算的方式和密 ...
- POJ 3683 Priest John's Busiest Day(2-SAT 并输出解)
Description John is the only priest in his town. September 1st is the John's busiest day in a year b ...
- BZOJ1022 [SHOI2008]小约翰的游戏John
Description 小约翰经常和他的哥哥玩一个非常有趣的游戏:桌子上有n堆石子,小约翰和他的哥哥轮流取石子,每个人取 的时候,可以随意选择一堆石子,在这堆石子中取走任意多的石子,但不能一粒石子也不 ...
随机推荐
- JavaEE
1. 为什么需要JavaEE 我们编写的JSP代码中,由于大量的显示代码和业务逻辑混淆在一起,彼此嵌套,不利于程序的维护和扩展.当业务需求发生变化的时候,对于程序员和美工都是一个很重的负担. 为了程 ...
- C++中的运算符重载
首先思考以下几个问题: 1.什么是运算符重载? 2.为什么要重载运算符,它有什么用? 3.可以重载哪些运算符? 4.重载运算符有哪些规则? 一.基本概念 我们在程序中使用各种操作符,比如加(+).赋值 ...
- jquery的children方法和css3选择器配合使用
$(".pid").children("ul:nth-child(2)");//获取拥有pid类元素下的第二个ul元素 $(".pid"). ...
- requirejs学习之路
2006年,由于微软的名声比SUN公司的名声要大,选择了asp.net,利用VS开发了很多项目,那个时候觉得自己真是很牛气,什么都能做:现在随着互联网和移动互联的冲击,这些传统技术也受到了冲击,由于A ...
- MTK 平台上查询当前使用的摄像头模组及所支持预览分辨率
1,MTK 平台如何查询当前使用的是哪颗摄像头及相关的模组信息? 在该目录下可以查到当前平台及相关项目的配置文件 ProjectConfig.mk \ALPS.JB.MP.V1_W_20120919\ ...
- Minimum Window Substring
Given a string S and a string T, find the minimum window in S which will contain all the characters ...
- SQL Server 维护计划实现数据库备份(Step by Step)
转自:http://www.cnblogs.com/gaizai/archive/2011/11/18/2254445.html 一.前言 SQL Server 备份和还原全攻略,里面包括了通过SSM ...
- Android自动化压力测试图解教程——Monkey工具
[置顶] Android自动化压力测试图解教程--Monkey工具 标签: 测试androidprofiling工具测试工具文档 2012-04-01 10:16 38185人阅读 评论(10) 收藏 ...
- 北京联想招聘-Android Framework高级工程师(7-10年) 加入qq 群:220486180 或者直接在此 留言咨询
Job ID #: 45038 Position Title: Android Framework高级工程师 Location: CHN-Beijing Functional Area: Resear ...
- IOS开发之——保存图片到相册的功能实现
//保存 UIButton *saveBtn = [[UIButton alloc] init]; // saveBtn.frame = CGRectMake((screenWi ...