#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. Ruby快速入门

    Rb是什么 ? 交互式Ruby(IRB)为实验提供了一个shell.内置IRB shell,你可以立即一行行查看表达式的结果.该工具自带Ruby安装,所以你必须做一些额外的IRB工作无关.只需键入在命 ...

  2. ibatis 常用标签

    prepend:自动在前面加上:自动新手:自动预:自动前置 property:属性 compareValue:指定的常数,值 //判断不相等: <isNotEqual prepend=" ...

  3. Sensitivity, specificity, and reproducibility of RNA-Seq differential expression calls RNA-Seq差异表达调用的灵敏度 特异性 重复性

    Sensitivity, specificity, and reproducibility of RNA-Seq differential expression calls RNA-Seq差异表达调用 ...

  4. oepnni安装

    sudo apt-get install libopenni-dev libopenni2-dev / apt-get install libqhull-dev

  5. SLAM拾萃(2):doxygen

    今天给大家介绍一下doxygen.这个工具由来已久了,至少08年左右就已经在用了,但是目前还没见到好的介绍.我个人觉得这是个很简单易用的工具,但是为什么看了别人介绍反而觉得复杂了……所以趁着今天比较闲 ...

  6. Basic4android v3.50 发布

    这次发布的主要是debug 的增强.说实话,在这一方面B4a 比delphi做的要好.希望delphi 在新的版本里面 能进一步加强. I'm happy to release Basic4andro ...

  7. 【转】C中的静态存储区和动态存储区

    一.内存基本构成    可编程内存在基本上分为这样的几大部分:静态存储区.堆区和栈区.他们的功能不同,对他们使用方式也就不同.    静态存储区:内存在程序编译的时候就已经分配好,这块内存在程序的整个 ...

  8. SpringMVC源码解析 - HandlerAdapter - HandlerMethodArgumentResolver

    HandlerMethodArgumentResolver主要负责执行handler前参数准备工作. 看个例子,红色部分的id初始化,填充值就是它干的活: @RequestMapping(value ...

  9. Codeforces758D Ability To Convert 2017-01-20 10:29 231人阅读 评论(0) 收藏

    D. Ability To Convert time limit per test 1 second memory limit per test 256 megabytes input standar ...

  10. VS2017新建控制器出现 No executable found matching command: dotnet-asp net-code generator解决办法

    编辑项目.csproj的文件,里面加上如下节点保存即可:  <ItemGroup>    <DotNetCliToolReference Include="Microsof ...