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
2 2
1
3
 
Sample Output
No
Yes
 
 
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的更多相关文章

  1. HDU 5754 Life Winner Bo 组合博弈

    Life Winner Bo Problem Description   Bo is a "Life Winner".He likes playing chessboard gam ...

  2. HDU 2509 Be the Winner nim博弈变形

    Be the Winner Problem Description   Let's consider m apples divided into n groups. Each group contai ...

  3. HDU5754 Life Winner Bo(博弈)

    题目 Source http://acm.hdu.edu.cn/showproblem.php?pid=5754 Description Bo is a "Life Winner" ...

  4. Codeforces Beta Round #2 A. Winner

    A. Winner time limit per test 1 second memory limit per test 64 megabytes input standard input outpu ...

  5. HDU2509 Be the Winner

    Be the Winner Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Tot ...

  6. 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 ...

  7. winner tree 胜者树

    在树形选择排序中,利用锦标赛思想建立的树称为胜者树. 1.每个非终端节点存储的是左右孩子节点中的优胜者. 2.通过减少比较次数,提高效率. 3.胜者树就是一颗特殊的线段树. 一.构建树 Procedu ...

  8. cf------(round 2)A. Winner

    A. Winner time limit per test 1 second memory limit per test 64 megabytes input standard input outpu ...

  9. CrowdFlower Winner's Interview: 1st place, Chenglong Chen

    CrowdFlower Winner's Interview: 1st place, Chenglong Chen The Crowdflower Search Results Relevance c ...

  10. HDU 5754 Life Winner Bo (博弈)

    Life Winner Bo 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5754 Description Bo is a "Life W ...

随机推荐

  1. angularjs的几种常见写法

    学习angularjs不久,遇见的angularjs的写法也是很多的感觉,今天就在这里记录一下,还有没见过的,继续学习中... angularjs 常用的几种种写法 1.链式: angular.mod ...

  2. java 线程二

    一.线程的优先级别 线程优先级别的使用范例: 1 package cn.galc.test; 2 3 public class TestThread6 { 4 public static void m ...

  3. C++11获取线程的返回值

    C++11 std::future and std::promise 在许多时候,我们会有这样的需求--即我们想要得到线程返回的值. 但是在C++11 多线程中我们注意到,std::thread对象会 ...

  4. DotNetCore跨平台~linux上还原自主nuget包需要注意的问题

    问题的产生的背景 由于我们使用了jenkins进行部署(jenkins~集群分发功能和职责处理),而对于.net core项目来说又是跨平台的,所以对它的项目拉取,包的还原,项目的编译和项目的发布都是 ...

  5. TeamFlowy——结合Teambition与Workflowy提高生产力

    Teambition是一个跨平台的团队协作和项目管理工具,相当于国外的Trello.使用Teambition可以像使用白板与便签纸一样来管理项目进度,如下图所示. Teambition虽然便于管理项目 ...

  6. 学习的Python教程中的一些问题

    2017开始学习Python,在网上找了很多教程,最后看到了Vamei的教程,感觉很简单易懂,但是过程中难免有不太容易理解的问题,做一些随笔,加深记忆亦可让以后学习的同学少走一些弯路. 1 Pytho ...

  7. zabbix灵活使用userparameters

    userparameters介绍 官网文献:https://www.zabbix.com/documentation/2.0/manual/config/items/userparameters 当我 ...

  8. java使用spark/spark-sql处理schema数据(spark1.6)

    1.spark是什么? Spark是基于内存计算的大数据并行计算框架. 1.1 Spark基于内存计算 相比于MapReduce基于IO计算,提高了在大数据环境下数据处理的实时性. 1.2 高容错性和 ...

  9. css笔记-文本样式

    聊聊text-decoration.text-indent.text-transform.letter-spacing.word-spacing.vertical-align.下面是一些常用设置文本样 ...

  10. android 屏幕适配基础(1)

    1. 概念定义 寸/英寸:   1寸=3.333333厘米:1英寸=2.54厘米(屏幕尺寸以英寸为单位) 像素 :    像素是组成图象的最基本单元要素:点. 一个像素有多大呢?主要取决于显示器的分辨 ...