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. WCF学习心得------(六)数据协定

    --前言 最近各种事忙的把之前的WCF学习给耽误了一些,今天抽时间把之前的学习内容给总结了一下,因为知识点比较细碎没有做太多的练习示例,只是对其中关键的知识点做了总结,希望可以对大家有所帮助. 第六章 ...

  2. 【shell】sort命令

    [root@andon ~]# sort 1 ##常用正序自动排序 101 paul 18 100 102 suan 11 99 103 peter 18 98 id name age score [ ...

  3. Javascript中函数的四种调用方式

    一.Javascript中函数的几个基本知识点: 1.函数的名字只是一个指向函数的指针,所以即使在不同的执行环境,即不同对象调用这个函数,这个函数指向的仍然是同一个函数. 2.函数中有两个特殊的内部属 ...

  4. python命令行下tab键补全命令

    在python命令行下不能使用tab键将命令进行补全,手动输入又很容易出错. 解决:tab.py #/usr/bin/env python # -*- coding:utf-8 -*- ''' 该模块 ...

  5. VisualSVN Server以及TortoiseSVN客户端的配置和使用方法

    http://www.cnblogs.com/beautifulFuture/archive/2014/07/01/3818211.html 近期学习代码管理工具,首先学习一下svn和Tortoise ...

  6. EventHandler委托与自定义委托

    http://blog.csdn.net/uuxyz/article/details/7175248 EventHandler委托与自定义委托 自定义委托: //1. public delegate ...

  7. .NET简谈插件系统开发模式

    摘选自[王清培]博客 http://www.cnblogs.com/wangiqngpei557/archive/2011/06/10/2077413.html 今天跟大家分享一下我们在日常开发中并不 ...

  8. 如何获取客户端IP、操作系统、浏览器

    request.getRemoteAddr();//获取IP request.getHeader("User-Agent");//获取操作系统信息.浏览器信息. protected ...

  9. Hbase与hive整合

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

  10. BEvent_标准BusinessEvent用以监控供应商的修改(案例)

    2014-06-01 Created By BaoXinjian