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博弈的变形,还是不知道怎么分析,,,,看了大牛的博客. 传送门 首先给出结 ...
随机推荐
- Spring 注解式Aop 入门
首先在spring配置文件中加上 xmlns:aop="http://www.springframework.org/schema/aop" http://www.springfr ...
- Python3 md5加密
import hashlibuser = 'jointwisdom'pwd = 'zhonghui123'm2 = hashlib.md5()m2.update(pwd.encode("ut ...
- 在http编程的门口----飞牛网自动下单,查单
刚进这个公司,以前没接触过http编程,所以这两天做了个小例子来熟悉http编程,有点晕..... 不过还是做出来了,虽然有点粗糙,总结一下这个小软件: 主要使用QNetworkAccessManag ...
- XTU 1249 Rolling Variance
$2016$长城信息杯中国大学生程序设计竞赛中南邀请赛$G$题 前缀和. 把公式化开来,会发现只要求一段区间的和以及一段区间的平方和就可以了. #pragma comment(linker, &quo ...
- StringMVC(拦截器)
单个拦截器 使用jar包 创建FirstController.java @Controller public class FirstController { @RequestMapping(" ...
- bootstrap的总结1 - 网格系统
1.Bootstrap 网格系统 1)下表总结了 Bootstrap 网格系统如何跨多个设备工作: 2)Bootstrap 网格的基本结构 <div class="container& ...
- [Q]系统环境改变导致“未注册”的解决方法
据用户反映设置账户开机密码后显示未注册, 具体表现: 1. 重装试用版,重新获取注册申请码,发现注册申请码跟原来没有发生变化. 2. 重新使用原来的授权文件注册,但打开后显示未注册. 3. 发现“** ...
- cshtml一二
布局页:_MyLayout.cshtml <!DOCTYPE html> @*Razor布局页*@ <html> <head> @*HTTP的头部协议,提示浏览器网 ...
- ElasticSearch(6)-结构化查询
引用:ElasticSearch权威指南 一.请求体查询 请求体查询 简单查询语句(lite)是一种有效的命令行_adhoc_查询.但是,如果你想要善用搜索,你必须使用请求体查询(request bo ...
- 跳转到设置页面 与appstory
//MARK:系统跳到应用设置页面 func systemMySet(){ let url = NSURL(string: UIApplicationOpenSettingsURLString) if ...