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
|
Sample Output
|
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 ...
随机推荐
- day14<常见对象+>
常见对象(正则表达式的概述和简单使用) 常见对象(字符类演示) 常见对象(预定义字符类演示) 常见对象(数量词) 常见对象(正则表达式的分割功能) 常见对象(把给定字符串中的数字排序) 常见对象(正则 ...
- PHP数组运算符
PHP数组预算符有==(等于),===(恒等于),!=(不等于),<>(不等于),+(联合): 注意:没有-(减号)运算符: $a=array("a"=>&quo ...
- 用wrk测试nginx/ndoejs/golang
sudo taskset -c ./wrk -c1 -t1 -d30 http://localhost/hello wrk+nginx(helloworld module) sudo taskset ...
- JQuery获取图片大小并控制图片文件上传大小以及上图片文件时如何预览图片
首先我们来看效果图: 点击上传之后如下: 在这里我获取到文件的大小,并且如果超出我设定的大小,则禁止上传! 不多说,上代码:先看div布局: <div class="imageCont ...
- Codeforces Round #410 (Div. 2)C. Mike and gcd problem
题目连接:http://codeforces.com/contest/798/problem/C C. Mike and gcd problem time limit per test 2 secon ...
- wireshark数据包分析实战 第二章
1,监听网络线路:即嗅探器的位置确定. 2,混杂模式:将网卡设置成混杂模式,网卡可以接受经过网卡的所有数据报,包括目的地址不是本网卡的数据报.这些数据都会发送给cpu处理,这样,wireshark就能 ...
- Django进阶篇【2】
在学习之前,我们补充一个知识点(static用法) 创建APP 配置: setting.py STATICFILES_DIRS = ( os.path.join(BASE_DIR,'static') ...
- 想到一个赚钱的APP
通过APP上发布调查问卷的需求,鼓励人们注册,并给与一定的报酬.需求主要面向一些调查问卷,一类的需求发布
- Python自学笔记-time模块(转)
在Python中,通常有这几种方式来表示时间:1)时间戳 2)格式化的时间字符串 3)元组(struct_time)共九个元素.由于Python的time模块实现主要调用C库,所以各个平台可能有所不同 ...
- 数据处理:12个使得效率倍增的pandas技巧
数据处理:12个使得效率倍增的pandas技巧 1. 背景描述 Python正迅速成为数据科学家偏爱的语言,这合情合理.它拥有作为一种编程语言广阔的生态环境以及众多优秀的科学计算库.如果你刚开始学习P ...