HDU1907 http://acm.hdu.edu.cn/showproblem.php?pid=1907

两种情况1.当全是1时,要看堆数的奇偶性

2.判断是奇异局势还是非奇异局势

代码:

 #include<stdio.h>
#include<iostream>
using namespace std;
int main()
{
int m,n;
cin>>n;
while(n--)
{
int temp=;
int ans=;
int a[];
cin>>m;
for(int i=; i<m; i++)
{
cin>>a[i];
ans^=a[i];
if(a[i]>)
temp=;
} if(temp==)
{
if(m%==)
{
cout<<"John"<<endl; }
else
{
cout<<"Brother"<<endl; }
}
else
{ if(ans==)
{
cout<<"Brother"<<endl;
}
else
cout<<"John"<<endl; }
}
}

最新文章

  1. React Native知识9-ScrollView组件
  2. 【前端】Three.js
  3. Pycharm 使用
  4. Windows性能计数器
  5. Backbone.js developer 武汉 年薪8w-10w
  6. Contoso 大学 - 2 – 实现基本的增删改查
  7. tableview 上拉时 标题行出现在顶部不动效果
  8. 无法关闭的QT程序——思路开阔一下,原来这么简单!
  9. 【自学php】第二天 - php快速入门
  10. HTML &lt;button&gt;标签
  11. Strut、Spring、Hibernate如何实现资源整合(SSH)呢?
  12. 7、正确的赚钱方式 - CEO之公司管理经验谈
  13. numpy(五)
  14. dp Surf
  15. SpringBoot------连接MySQL报错:The server time zone value &#39;&#214;&#208;&#185;&#250;&#177;&#234;&#215;&#188;&#202;&#177;&#188;&#228;&#39; is unrecognized
  16. 大道至简第一章读后感JAVA伪代码形式
  17. jQuery获取元素上一个、下一个、父元素、子元素
  18. Linux_CentOS-服务器搭建 &lt;五&gt; 补充
  19. (转)C# WebApi 身份认证解决方案:Basic基础认证
  20. c++从文件中读取一行数据并保存在数组中

热门文章

  1. 【shell】case语句
  2. 一个android的各种控件库
  3. visual studio 2013 中常用的一些快捷键
  4. Eclipse:启动时提示&quot;Failed to load the JNI shared library&quot;的解决方案
  5. 一个原生的JavaScript拖动方法
  6. JMS的常用方法
  7. windows环境下 生成git公钥和私钥
  8. centos下的一些命令
  9. this web application instance has been stopped already解决办法
  10. linux查看和开放某端口