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博弈的变形,还是不知道怎么分析,,,,看了大牛的博客. 传送门 首先给出结 ...
随机推荐
- java加解密
换工作中,把以前学的知识,整理整理.能否得到一份好的薪资且满意的工作,然后赢取白富美,走向人生的巅峰,就靠它了.哈哈. 对称加密:DES, AES DES (数据加密算法) : 明文按64位进行分组, ...
- Python 的基本使用说明
1.先定义一个被调用的模块,文件名 cnf.py #!/usr/bin/ #coding=utf- import sys reload(sys) sys.setdefaultencoding( &qu ...
- 从源码Build vim以及打包.deb
How to build vim 1. Build步骤 git clone --depth https://github.com/vim/vim.git # download the source c ...
- http协议的状态码 403 404 301 302 200 500 502 504 报错显示
在网站建设的实际应用中,容易出现很多小小的失误,就像MySQL当初优化不到位,影响整体网站的浏览效果一样,其实,网站的常规http状态码的表现也是一样,Google无法验证网站几种解决办法,提及到由于 ...
- idea新建项目文件名为红色的解决办法
Perference->version Control ->Directory添加项目路径,vcs选<none> 即可.
- Jquery几秒自动跳转
$(document).ready(function() { function jump(count) { window.setTimeout(function(){ count--; if(coun ...
- #大数加减乘除#校赛D题solve
#include<iostream> #include<cstdio> #include<cstring> #include<string> #incl ...
- NEUQ1038: 谭浩强C语言(第三版)习题4.8
之前没做对的一道题,今天集中清理一下. //------------------- 很水的题,主要是 %.2lf 不能四舍五入,需要仅保留两位小数,用了丑陋的强制类型转换... //--------- ...
- swift 中Value Type VS Class Type
ios 中Value Type 和 Class Type 有哪些异同点,这个问题是在微信的公共帐号中看到的,觉得挺有意思,这里梳理一下. 1.swift 中为什么要设置值类型? 值类型在参数传递.赋值 ...
- C#中的引用传递、值传递
先来说下C#中的数据类型.分值类型和引用类型两大类. 值类型:直接存储数据的值,保存在内存中 引用类型:存储对值的引用,实际上存储的就是一个内存的地址 C#预定义的简单类型,像int,float, ...