HDU2176 http://acm.hdu.edu.cn/showproblem.php?pid=2176

假设有3个数,a[0],a[1],a[2];那么ans=a[0]^a[1]^a[2];若ans^a[0]=s;

那么a[1]^a[2]^s=a[1]^a[2]^ans^a[0]=a[1]^a[2]^a[0]^a[1]^a[2]^a[0]=0(根据异或的性质)。

上代码:

 #include<stdio.h>
#include<iostream>
#include<string.h>
using namespace std;
int main()
{
int m,n;
int a[];
int ans=;
while(~scanf("%d",&n)&&n){
for(int i=;i<n;i++){
cin>>a[i];
ans^=a[i];
}
if(ans==)
cout<<"No"<<endl;
else {cout<<"Yes"<<endl;
for(int i=;i<n;i++){
int s=ans^a[i];
if(s<=a[i])
cout<<a[i]<<" "<<s<<endl;
}
}
}
}

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

  1. hdu2176 尼姆博弈

    如果 a1^a2^a3........^an=0,必败态. 如果 a1^a2^a3........^an!=0,必胜态. 对于必胜态,若a1^a2^a3........^an=k,要让对方为必败态,所 ...

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  9. hdu-------(1848)Fibonacci again and again(sg函数版的尼姆博弈)

    Fibonacci again and again Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Jav ...

随机推荐

  1. UI-导航控制器的使用

    1.初始化导航栏控制器 2..设置导航栏的标题 3.跳到下一个页面 4.返回上一个页面 5.自定义返回页面 6.导航栏上的自定义返回按钮 7.两个导航栏显示隐藏的常用方法(当前页不显示)

  2. 基础:从概念理解Lucene的Index(索引)文档模型

    转:http://blog.csdn.net/duck_genuine/article/details/6053430   目录(?)[+]   Lucene主要有两种文档模型:Document和Fi ...

  3. IntelliJ IDEA中怎么查看文件中所有方法?

    可以使用快捷键ALT + 7打开左侧的Structure查看当前文件中的所有方法.   来自为知笔记(Wiz)

  4. Chrome离线下载地址

    每当chrome有更新之后,都有不少用户想要下载离线版的安装文件,但苦于找不到下载地址而发愁,其实这个问题很简单,下面我来分享一下方法(仅针对Windows操作系统): 对于稳定版(正式版)Chrom ...

  5. android学习笔记15——Galley

    Gallery==>画廊视图 Gallery和Spinnery父类相同——AbsSpinner,表明Garrey和Spinner都是一个列表框. 两者之间的区别是:Spinner显示的是一个垂直 ...

  6. 【freemaker】之FreeMakerUtil工具类

    Freemaker生成文件常用工具类 public class FreemakerUtil { private static FreemakerUtil util; private static Co ...

  7. 黄聪:VPS实现自动定时备份网站数据以及Mysql数据库到百度云同步盘

    建站多了,备份成了头疼的问题,因为你不知道你的VPS什么时候会宕机或者服务商跑路,一旦网站数据丢失,那么相当于前功尽弃了,所以自己研究出了一套自动备份的方法. 需要的东西: 1.一个VPS(虚拟空间没 ...

  8. PLSQL_性能优化系列14_Oracle High Water Level高水位分析

    2014-10-04 Created By BaoXinjian 一.摘要 PLSQL_性能优化系列14_Oracle High Water Level高水位分析 高水位线好比水库中储水的水位线,用于 ...

  9. DBA_Oracle AWR Report性能监控报表(案例)

    2014-08-22 Created By BaoXinjian

  10. Report_客制化Excel报表中的XLS标记(案例)

    2014-06-06 Created By BaoXinjian