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; }
}
}

尼姆博弈HDU1907的更多相关文章

  1. HDU1907(尼姆博弈)

    John Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)Total Submis ...

  2. hdu1907 尼姆博弈

    尼姆博弈的性质. 最后一个取输.若a1^a2^a3...^a4=0表示利他态T,不然为利己态S.充裕堆:1个堆里的个数大于2.T2表示充裕堆大于等于2,T1表示充裕堆大于等于1,T0表示无充裕堆.S2 ...

  3. hdu----(1849)Rabbit and Grass(简单的尼姆博弈)

    Rabbit and Grass Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) ...

  4. hdu 1849(Rabbit and Grass) 尼姆博弈

    Rabbit and Grass Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) ...

  5. Being a Good Boy in Spring Festival 尼姆博弈

    Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Descr ...

  6. HDU 4315 Climbing the Hill (阶梯博弈转尼姆博弈)

    Climbing the Hill Time Limit: 1000MS   Memory Limit: 32768KB   64bit IO Format: %I64d & %I64u Su ...

  7. Light OJ 1393 Crazy Calendar (尼姆博弈)

    C - Crazy Calendar Time Limit:4000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Su ...

  8. LightOJ 1247 Matrix Game (尼姆博弈)

    A - Matrix Game Time Limit:2000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Submi ...

  9. Light OJ 1253 Misere Nim (尼姆博弈(2))

    LightOJ1253 :Misere Nim 时间限制:1000MS    内存限制:32768KByte   64位IO格式:%lld & %llu 描述 Alice and Bob ar ...

随机推荐

  1. Math.Round函數

    Math.Round這個函數的解釋是將值按指定的小數位數舍入,但並不就是四捨五入.這種舍入有時稱為就近舍入或四舍六入五成雙 其實在 VB, VBScript, C#, J#, T-SQL 中 Roun ...

  2. jQuery图片无缝滚动JS代码ul/li结构

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  3. 再看erlang的socket部分基础

    socket的选项里面的{packet,0}和{packet,raw}的区别 {packet,} erlang处理2字节大端包头 {packet,} erlang处理4字节大端包头 {packet,} ...

  4. 警告: [SetContextPropertiesRule]{Context} Setting property 'source' to 'org.eclipse.jst.jee.server:20160928' did not find a matching property

    控制台看到如下警告: 症状原因: 在eclipse配置好的tomcat服务器上双击,打开tomcat服务器的配置界面.按如下操作配置服务器:在Server Options勾上的选项,会在你部署web项 ...

  5. struts 2 <s:select> 标签

    名称 必填 缺省值 类型 描述 emptyOption false false Boolean 是否在题头选项后面添加一个空的(--)选项 headerKey false   Object/Strin ...

  6. C# new 和 override.

    http://www.dotblogs.com.tw/skychang/archive/2012/05/10/72114.aspx?fid=60865

  7. Hbase与hive整合

    //hive与hbase整合create table lectrure.hbase_lecture10(sname string, score int) stored by 'org.apache.h ...

  8. NeHe OpenGL教程 第三十五课:播放AVI

    转自[翻译]NeHe OpenGL 教程 前言 声明,此 NeHe OpenGL教程系列文章由51博客yarin翻译(2010-08-19),本博客为转载并稍加整理与修改.对NeHe的OpenGL管线 ...

  9. ZOJ 3601 Unrequited Love 浙江省第九届省赛

    Unrequited Love Time Limit: 16 Seconds      Memory Limit: 131072 KB There are n single boys and m si ...

  10. 在单线程中你最好使用ArrayList而不是Vector

    <java核心技术卷一>571页上提到Vector类的所有方法都是同步的.可以由两个线程安全地访问同一个Vector对象.显然,如果可以确定我们不会在多个线程中对这个数组进行操作的话,我们 ...