HDUOJ----John
John
Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)
Total Submission(s): 2095 Accepted Submission(s): 1133
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.
Constraints:
1 <= T <= 474,
1 <= N <= 47,
1 <= Ai <= 4747
//http://acm.hdu.edu.cn/showproblem.php?pid=1907
#include<iostream>
#include<vector>
#include<cstdio>
using namespace std; int main()
{
int t,n,i,x;
bool flag ;
cin>>t;
while(t--)
{
scanf("%d",&n);
vector<int>num(n+);
x=,flag=false;
for(i=;i<n;i++)
{
scanf("%d",&num[i]);
x^=num[i];
}
for(i=;i<n;i++)
{
if(num[i]>)
{
flag=true;
break;
}
}
if(flag)
{
if(x) puts("John");
else puts("Brother");
}
else
{
if(n&)
puts("Brother"); //奇数 win
else
puts("John"); //偶数 win
}
}
return ;
}
HDUOJ----John的更多相关文章
- hduoj 4706 Herding 2013 ACM/ICPC Asia Regional Online —— Warmup
hduoj 4706 Children's Day 2013 ACM/ICPC Asia Regional Online —— Warmup Herding Time Limit: 2000/1000 ...
- John the ripper使用教程
破解Linux的用户密码:John [跨平台的密码解密工具] root@only:~# unshadow /etc/passwd /etc/shadow > ~/file_to_crack ro ...
- HDU 1907 John nim博弈变形
John Problem Description Little John is playing very funny game with his younger brother. There is ...
- hduoj 1455 && uva 243 E - Sticks
http://acm.hdu.edu.cn/showproblem.php?pid=1455 http://uva.onlinejudge.org/index.php?option=com_onlin ...
- 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堆石子,小约翰和他的哥哥轮流取石子,每个人取 的时候,可以随意选择一堆石子,在这堆石子中取走任意多的石子,但不能一粒石子也不 ...
- HDU1907 John
Description Little John is playing very funny game with his younger brother. There is one big box fi ...
- HDOJ 1907 John
对于任意一个 Anti-SG 游戏,如果我们规定当局面中所有的单一游戏的 SG 值为 0 时,游戏结束,则先手必胜当且仅当: (1)游戏的 SG 函数不为 0 且游戏中某个单一游戏的 SG 函数大于 ...
随机推荐
- cout的输出格式初探2
#include <iostream> #include <iomanip> using namespace std; int main() { cout<<&qu ...
- 服务信息块协议 SMB(Server Message Block protocol)
SMB(Server Message Block)是协议名,它能被用于Web连接和客户端与服务器之间的信息沟通. SMB协议 SMB最初是IBM的贝瑞·费根鲍姆(Barry Feigenbaum)研制 ...
- scala编程第16章学习笔记(4)——List对象的方法
通过元素创建列表:List.apply List(1, 2, 3) 等价于List.apply(1, 2, 3): scala> List.apply(1, 2, 3) res0: List[I ...
- Windows 下Npm和NodeJS升级
前提电脑中已经安装过NodeJS, npm.现在需要进行升级操作. 1.查看当前的npm和NodeJs的版本: C:\Users\Administrator>node -vv4.4.3 C:\U ...
- graphic rendering pipeline
整理下管线 此时一定要有这张图 注意表中的数据流向 强调几个细节 之前对次序理解有点乱 rasterizer之前 管线里是只有逐顶点信息的 IA里面会setup primitive 通过Primit ...
- 变量声明置顶规则、函数声明及函数表达式和函数的arguments属性初始化
一.变量声明和变量赋值: if (!("a" in window)) { ; } alert(a);//a为? 你可能认为alert出来的结果是1,然后实际结果是“undefine ...
- 【转】NativeScript的工作原理:用JavaScript调用原生API实现跨平台
原文:https://blog.csdn.net/qq_21298703/article/details/44982547 -------------------------------------- ...
- [Node.js]27. Level 5: URL Building & Doing the Request
Let's create a page which calls the twitter search API and displays the last few results for Code Sc ...
- java基础-类变量,类方法
- 用Java发送HTML格式邮件测试类(支持中文)
代码由纯Java写成,支持中文,一目了然,只要将Main函数中的相关信息填写正确就直接用了,便于修改,可以在此类基础上任意扩展成自己的类. 注意做HTML形式的邮件,最好把HTML,CSS都写全,只写 ...