Be the Winner
Be the Winner |
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) |
Total Submission(s): 63 Accepted Submission(s): 48 |
Problem Description
Let's consider m apples divided into n groups. Each group contains no more than 100 apples, arranged in a line. You can take any number of consecutive apples at one time.
For example "@@@" can be turned into "@@" or "@" or "@ @"(two piles). two people get apples one after another and the one who takes the last is the loser. Fra wants to know in which situations he can win by playing strategies (that is, no matter what action the rival takes, fra will win). |
Input
You will be given several cases. Each test case begins with a single number n (1 <= n <= 100), followed by a line with n numbers, the number of apples in each pile. There is a blank line between cases.
|
Output
If a winning strategies can be found, print a single line with "Yes", otherwise print "No".
|
Sample Input
2 |
Sample Output
No |
Source
ECJTU 2008 Autumn Contest
|
Recommend
lcy
|
/*
题意;n堆物品,谁拿最后一个谁输 初步思路:裸的尼姆博弈
*/
#include<bits/stdc++.h>
using namespace std;
int n;
int res,a;
int main(){
// freopen("in.txt","r",stdin);
int ca=;
while(scanf("%d",&n)!=EOF){
res=;
int f=;
for(int i=;i<n;i++){
scanf("%d",&a);
if(a>) f=;
res^=a;
}
if(f) printf(res?"Yes\n":"No\n");
else printf(n&?"No\n":"Yes\n");
}
return ;
}
Be the Winner的更多相关文章
- HDU 5754 Life Winner Bo 组合博弈
Life Winner Bo Problem Description Bo is a "Life Winner".He likes playing chessboard gam ...
- HDU 2509 Be the Winner nim博弈变形
Be the Winner Problem Description Let's consider m apples divided into n groups. Each group contai ...
- HDU5754 Life Winner Bo(博弈)
题目 Source http://acm.hdu.edu.cn/showproblem.php?pid=5754 Description Bo is a "Life Winner" ...
- Codeforces Beta Round #2 A. Winner
A. Winner time limit per test 1 second memory limit per test 64 megabytes input standard input outpu ...
- HDU2509 Be the Winner
Be the Winner Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Tot ...
- Recruit Coupon Purchase Winner's Interview: 2nd place, Halla Yang
Recruit Coupon Purchase Winner's Interview: 2nd place, Halla Yang Recruit Ponpare is Japan's leading ...
- winner tree 胜者树
在树形选择排序中,利用锦标赛思想建立的树称为胜者树. 1.每个非终端节点存储的是左右孩子节点中的优胜者. 2.通过减少比较次数,提高效率. 3.胜者树就是一颗特殊的线段树. 一.构建树 Procedu ...
- cf------(round 2)A. Winner
A. Winner time limit per test 1 second memory limit per test 64 megabytes input standard input outpu ...
- CrowdFlower Winner's Interview: 1st place, Chenglong Chen
CrowdFlower Winner's Interview: 1st place, Chenglong Chen The Crowdflower Search Results Relevance c ...
- HDU 5754 Life Winner Bo (博弈)
Life Winner Bo 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5754 Description Bo is a "Life W ...
随机推荐
- 【个人笔记】《知了堂》express模块
NPM 包管理器 Node package module ==>简称npm 类似的bower 安装express 1.全局Npm install express -g 2.项目中安装 项目中 ...
- (1)pygame_第一个窗口程序
####可以使用python自带的IDLE交互式开发,也可以借助其他的编辑器,我这里采用的pycharm编辑器 1.导入我们所需要的模块 import pygame,sys --导入我们需要的模块 ...
- CentOS 引导 Win10 启动项
因为无聊,所以想尝试一下双系统,所以在win10的基础之上,装了一个Linux系统,之前装过Ubuntu,几乎都是自动完成的无任何压力.但是想着Ubuntu好像更新换代有点快,所以换了个能用比较久的C ...
- Permutations 好题
Permutations Time Limit: 20000/10000MS (Java/Others) Memory Limit: 128000/64000KB (Java/Others) Subm ...
- Online Bayesian Probit Regression介绍之Factor Graph
下面就开始讲讲概率图中的Factor Graph.概率图博大精深,非我等鼠辈能够完全掌握,我只是通过研究一些通用的模型,对概率图了解了一点皮毛.其实我只是从概率这头神兽身上盲人摸象地抓掉几根毛,我打算 ...
- nodejs+express+mongoose无法获取数据库数据问题解决
通过mongoose与mongodb进行操作.而mongoose是通过model来创建mongodb中对应的collection的,这样你通过如下的代码: mongoose.model('User', ...
- spring 内部工作机制(二)
本章节讲Spring容器从加载配置文件到创建出一个完整Bean的作业流程及参与的角色. Spring 启动时读取应用程序提供的Bean配置信息,并在Spring容器中生成一份相应的Bean配置注册表, ...
- 将本地代码上传到github
准备工作上传本地代码到github 准备工作 在github上创建自己的Repository. 安装git,centos的git安装教程. 上传本地代码到github git init git add ...
- python识别验证码——一般的数字加字母验证码识别
1.验证码的识别是有针对性的,不同的系统.应用的验证码区别有大有小,只要处理好图片,利用好pytesseract,一般的验证码都可以识别 2.我在识别验证码的路上走了很多弯路,重点应该放在怎么把图片处 ...
- IPSec协议
IPSec协议:IPsec将IP数据包的内容先加密再传输,即便中途被截获,由于缺乏解密数据包所必要的密钥,攻击者也无法获取里面的内容. 传输模式和隧道模式:IPsec对数据进行加密的方式有两种:传输模 ...