hdu2509 Be the Winner 博弈

时间:2022-01-03 02:17:46

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

博弈

 #include<stdio.h>

 int main(){
int n;
while(scanf("%d",&n)!=EOF){
int i,sum=,num=;
for(i=;i<=n;i++){
int a;
scanf("%d",&a);
if(a>)num++;
sum^=a;
}
if((num==&&sum==)||(sum>&&num>))printf("Yes\n");
else printf("No\n");
}
return ;
}

hdu2509 Be the Winner 博弈的更多相关文章

  1. HDU2509 Be the Winner

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

  2. HDU-2509 Be the Winner

    http://acm.hdu.edu.cn/showproblem.php?pid=2509 Be the Winner Time Limit: 2000/1000 MS (Java/Others)  ...

  3. HDU-2509-Be the Winner&comma;博弈题~~水过~~

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

  4. hdu 2509 Be the Winner 博弈

    题目链接 有n堆苹果, 对于其中的每一堆的x个苹果, 它是放在一条线上的. 你每次可以对一堆苹果进行操作, 可以取y个, 1<=y<=x. 然后如果你是取的一条线上中间的苹果, 那么这一堆 ...

  5. anti-nim 游戏

    游戏描述: 桌上有n堆石子,游戏双方轮流取石子,每次只能从一堆中取出任意数目的石子,不能不取,取走最后一个石子者失败. 结论: 先手必胜,当且仅当: ①.所有堆的石子数都为1,且游戏的SG值为0. ② ...

  6. HDU 5754 Life Winner Bo 组合博弈

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

  7. hdu 1907 John&amp&semi;&amp&semi; hdu 2509 Be the Winner(基础nim博弈)

    Problem Description Little John is playing very funny game with his younger brother. There is one bi ...

  8. hdu2509Be the Winner&lpar;反nim博弈&rpar;

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

  9. hdu-5754 Life Winner Bo&lpar;博弈&rpar;

    题目链接: Life Winner Bo Time Limit: 2000/1000 MS (Java/Others)     Memory Limit: 131072/131072 K (Java/ ...

随机推荐

  1. 浅谈C&plus;&plus;设计模式之抽象工厂(Abstract Factory)

    抽象工厂(Abstract Factory)模式是为了提供一系列相关或相互依赖对象的接口.对象创建型模式的一种. 客户Client 抽象工厂接口AbstractFactory 抽象工厂的实现类Conc ...

  2. java基础:所有参数皆是按值参数

    c#中对于参数的传递,有二种处理方式,默认情况下:值类型的参数,按值传递(即:方法体内的参数是原值的副本):引用类型的参数,"加ref关键字后“,按引用传递(即:方法体内的参数,是对象的指针 ...

  3. elk深度解析

    上面的两张图是elk的一个架构 下面是对logstash分析:如下图 可以看出 logstash的一个角色shipper,(是通过配置文件来决定logstash是shipper还是indexer)注意 ...

  4. PHP读文件的一个乱码问题

    D:/3.txt是utf-8文件 $f1 = fopen('D:/3.txt','r');$str = fread($f1,10000);fclose($f1);echo substr($str,1, ...

  5. 6&period;原型模式&lpar;Prototype Pattern&rpar;

    using System; namespace ConsoleApplication5 { class Program { static void Main(string[] args) { // 孙 ...

  6. Digest &lbrack;IAB&lowbar;SRI&lowbar;Online&lowbar;Advertising&lowbar;Effectiveness&rsqb;

    http://www.pwc.com/en_GX/gx/entertainment-media/pdf/IAB_SRI_Online_Advertising_Effectiveness_v3.pdf

  7. Sqoop详细介绍包括:sqoop命令,原理,流程

    一简介 Sqoop是一个用来将Hadoop和关系型数据库中的数据相互转移的工具,可以将一个关系型数据库(例如 : MySQL ,Oracle ,Postgres等)中的数据导进到Hadoop的HDFS ...

  8. Atom 编辑器 前端基本插件

    Atom 编辑器插件 这个编辑器是github出品,现在处于免费试用期:如果是初学者,可以使用这个编辑器,插件安装很方便,只需要点菜单栏的File-Settings-Install,在搜索框中输入想要 ...

  9. Vue学习笔记-Vue基础入门

    此篇文章是本人在学习Vue是做的部分笔记的一个整理,内容不是很全面,希望能对阅读文章的同学有点帮助. 什么是Vue? Vue.js (读音 /vjuː/,类似于 view) 是一套构建用户界面的渐进式 ...

  10. 将应用部署到Tomcat根目录的方法

    将应用部署到Tomcat根目录的目的是可以通过“http://[ip]:[port]”直接访问应用,而不是使用“http://[ip]:[port]/[appName]”上下文路径进行访问.   方法 ...