#include<iostream>
#include<stdio.h>
#include<algorithm>
#define MAXN 100
using namespace std;
//把所有堆的石子数目用二进制数表示出来,当全部这些数按位异或结果为0时当前局面为必败局面,否则为必胜局面;
int a[MAXN];
void op(int & num);
int trans_10_to_2(int num);
int main()
{
//freopen("acm.acm","r",stdin);
int num;
int i;
int tem;
int sum;
while(cin>>num)
{
sum = ;
memset(a,,sizeof(a));
for(i = ; i < num; ++ i)
{
cin >> tem;
trans_10_to_2(tem);
}
for_each(a,a+MAXN,op);
for(i = ; i < MAXN; ++ i)
{
if(a[i] == )
{
cout<<"Yes"<<endl;
break;
}
}
if(i == MAXN)
cout<<"No"<<endl;
}
} int trans_10_to_2(int num)
{
int mod;
int i;
i = ;
while(num)
{
mod = num%;
num /= ;
a[i ++] += mod;
}
return i;
} void op(int & num)
{
if(num % == )
num = ;
else
num = ;
}

关注我的公众号,当然,如果你对Java, Scala, Python等技术经验,以及编程日记,感兴趣的话。

技术网站地址: vmfor.com

POJ 2234的更多相关文章

  1. POJ 2234 Matches Game

    Matches Game Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 7567   Accepted: 4327 Desc ...

  2. POJ 2234 Matches Game(取火柴博弈1)

    传送门 #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> ...

  3. POJ 2234 Matches Game 尼姆博弈

    题目大意:尼姆博弈,判断是否先手必胜. 题目思路: 尼姆博弈:有n堆各a[]个物品,两个人轮流从某一堆取任意多的物品,规定每次至少取一个,多者不限,最后取光者得胜. 获胜规则:ans=(a[1]^a[ ...

  4. 题解——POJ 2234 Matches Game

    这道题也是一个博弈论 根据一个性质 对于\( Nim \)游戏,即双方可以任取石子的游戏,\( SG(x) = x \) 所以直接读入后异或起来输出就好了 代码 #include <cstdio ...

  5. POJ 2234 Matches Game(Nim博弈裸题)

    Description Here is a simple game. In this game, there are several piles of matches and two players. ...

  6. POJ 2234 Matches Game (尼姆博弈)

    题目链接: https://cn.vjudge.net/problem/POJ-2234 题目描述: Here is a simple game. In this game, there are se ...

  7. POJ 2234 Nim博弈

    思路: nim博弈裸题 xor一下 //By SiriusRen #include <cstdio> using namespace std; int n,tmp,xx; int main ...

  8. SG函数和SG定理【详解】

    在介绍SG函数和SG定理之前我们先介绍介绍必胜点与必败点吧. 必胜点和必败点的概念:        P点:必败点,换而言之,就是谁处于此位置,则在双方操作正确的情况下必败.        N点:必胜点 ...

  9. (转载)--SG函数和SG定理【详解】

    在介绍SG函数和SG定理之前我们先介绍介绍必胜点与必败点吧. 必胜点和必败点的概念:        P点:必败点,换而言之,就是谁处于此位置,则在双方操作正确的情况下必败.        N点:必胜点 ...

随机推荐

  1. java 主类的main方法调用其他方法

    方法1:A a=new test().new A(); 内部类对象通过外部类的实例对象调用其内部类构造方法产生,如下: public class test{ class A{ void fA(){ S ...

  2. Centos 7 安装和配置Redis

    一. 安装 操作系统:Centos 7. 最小化安装 redis版本: 4.0.6 服务器地址:*** 第一步:下载redis安装包(如果有新的,下载最新的redis安装包) wget http:// ...

  3. Error generating final archive: Unable to get debug signature key

    在调试程序时,发生下面的错误: Error generating final archive: Unable to get debug signature key 解决办法: 删除下面的文件: C:\ ...

  4. nodename nor servname provided, or not known

    mac来使用redis然后产生上述错误,据说是用户名的问题 解决: 打开终端: cat /private/etc/hosts sudo vi /private/etc/hosts 将错误的那个名字加入 ...

  5. php 访问用友u8数据

    <?php namespace app\api\controller; use think\Controller; use think\Db; use think\Log; /** * desc ...

  6. Spring源码解析 - BeanFactory

    BeanFactory是Spring实现依赖注入的核心接口.提供应用的统一配置注册功能,实现业务开发解偶.使用getBean可以代替单例,原型设计模式. 顶重要的BeanFactory里注释写得太好了 ...

  7. ZOJ3700 Ever Dream 2017-04-06 23:22 76人阅读 评论(0) 收藏

    Ever Dream Time Limit: 2 Seconds      Memory Limit: 65536 KB  "Ever Dream" played by Nigh ...

  8. android多lib库工程的自动批量构建--准备

    打包这个活儿吧,本来没什么技术含量,千篇一律的更改渠道名称,然后编译,签名即可.但是如果发布渠道比较多的话,这种重复工作让人烦不胜烦.我们的应用发布渠道有30多个,若是手工打包,基本不用做其他的事情了 ...

  9. Spring 框架简介

    Spring 是一个开源框架,是为了解决企业应用程序开发复杂性而创建的.框架的主要优势之一就是其分层架构,分层架构允许您选择使用哪一个组件,同时为 J2EE 应用程序开发提供集成的框架. 在这篇由三部 ...

  10. [label][Node.js] Three content management systems base on Node.js

    1. Keystonejs http://keystonejs.com/ 2. Apostrophe http://apostrophenow.org/