HDU 2509 Be the Winner(取火柴博弈2)
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std; int main()
{
int n;
while(~scanf("%d",&n))
{
int a,res=0;
int c=0,g=0;
for(int i=0;i<n;i++)
{
scanf("%d",&a);
if(a>=2) c++;
else if(a==1) g++;
res^=a;
}
if(!res)
{
if(c>=2)//T2
printf("No\n");
else if(c==0)
printf("Yes\n");
}
else//S
{
if(g&1&&c==0)//S0
printf("No\n");
else if(c==1||c>=2)//S1,S2
printf("Yes\n");
}
}
return 0;
}
HDU 2509 Be the Winner(取火柴博弈2)的更多相关文章
- hdu 1907 John&& hdu 2509 Be the Winner(基础nim博弈)
Problem Description Little John is playing very funny game with his younger brother. There is one bi ...
- HDU 2509 Be the Winner nim博弈变形
Be the Winner Problem Description Let's consider m apples divided into n groups. Each group contai ...
- hdu 2509 Be the Winner 博弈
题目链接 有n堆苹果, 对于其中的每一堆的x个苹果, 它是放在一条线上的. 你每次可以对一堆苹果进行操作, 可以取y个, 1<=y<=x. 然后如果你是取的一条线上中间的苹果, 那么这一堆 ...
- (step8.2.2)hdu 2509(Be the Winner——简单博弈)
题目大意:输入一个整数n,表示火柴堆数(原题其实指的是苹果堆数,但是为了尽量与模板保持一致,所以在这里理解为火柴堆数....其实理解为什么都没关系, 重要的是,理解就行....).在接下来的一行中,有 ...
- HDU 1907 John(取火柴博弈2)
传送门 #include<iostream> #include<cstdio> #include<cstring> using namespace std; int ...
- hdu 2509 Be the Winner(anti nim)
Be the Winner Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Tot ...
- hdu 2509 Be the Winner 博弈论
博弈论水题!!! 代码如下: #include<stdio.h> #include<iostream> using namespace std; int main(){ int ...
- POJ 2234 Matches Game(取火柴博弈1)
传送门 #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> ...
- HDU 2509 Nim博弈变形
1.HDU 2509 2.题意:n堆苹果,两个人轮流,每次从一堆中取连续的多个,至少取一个,最后取光者败. 3.总结:Nim博弈的变形,还是不知道怎么分析,,,,看了大牛的博客. 传送门 首先给出结 ...
随机推荐
- mysqldump 备份直接至压缩文件,提高备份及压缩时间
1.备份及压缩分开 备份mysqldump --single-transaction -hlocalhost --all-databases --triggers --routines --event ...
- childNodes属性 和 nodeType属性
childNodes属性可以用来获取任何一个元素的所有子元素,它是一个包含这个元素的全部子元素的数组:element.childNodes 如果需要把某个文档的body元素的全体子元素检索出来.首先使 ...
- C# 动态对象(dynamic)的用法
说到正确用法,那么首先应该指出一个错误用法: 常有人会拿var这个关键字来和dynamic做比较.实际上,var和dynamic完全是两个概念,根本不应该放在一起做比较.var实际上是编译期抛给我们的 ...
- Zookeeper,Kafka,Spark关系
Kafka中ZooKeeper的用途 正如ZooKeeper用于分布式系统的协调和促进,Kafka使用ZooKeeper也是基于相同的原因.ZooKeeper用于管理.协调Kafka代理.每个Kafk ...
- sqlcipher for android
github 地址 https://github.com/sqlcipher/android-database-sqlcipher 官网教程 https://www.zetetic.net/sqlci ...
- MyBatis学习-映射文件标签篇(select、resultMap)
MyBatis 真正的核心在映射文件中.比直接使用 JDBC 节省95%的代码.而且将 SQL 语句独立在 Java 代码之外,可以进行更为细致的 SQL 优化. 一. 映射文件的顶级元素 selec ...
- thinkphp5.0 自动加载
自动加载 概述 ThinkPHP5.0真正实现了按需加载,所有类库采用自动加载机制,并且支持类库映射和composer类库的自动加载. 自动加载的实现由think\Loader类库完成,自动加载规范符 ...
- java 获取URL链接 内容
public static String getHtmlConentByUrl(String ssourl) { try { URL url = new URL( ...
- onkeyup事件只能输入数字,字母,下划线
<input type="text" onkeyup="value=value.replace(/[\W]/g,'')"/>
- SQL 分组排序、CASE...WHEN...、是否为空 查询
select Id,CustomerCode,CustomerName,CreateId,CreateName,Phone,StatusName,(case when phone is not nu ...