hdoj--2509--Be the Winner(尼姆博弈)
Be the Winner
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 2718 Accepted Submission(s): 1487
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).
2
2 2
1
3
No
Yes#include <stdio.h>
#include <string.h>
using namespace std;
#define M 50
int num[M];
int main()
{
int i,ans,re,n;
while(scanf("%d",&n)!=EOF)
{
ans=0,re=0;
for(i=0;i<n;i++)
{
scanf("%d",&num[i]);
if(num[i]>1)
ans++;
re^=num[i];
}
if(ans)
{
if(re)
printf("Yes\n");
else
printf("No\n");
}
else
{
if(re)
printf("No\n");
else
printf("Yes\n");
}
}
return 0;
}
hdoj--2509--Be the Winner(尼姆博弈)的更多相关文章
- hdu-------(1848)Fibonacci again and again(sg函数版的尼姆博弈)
Fibonacci again and again Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Jav ...
- hdu 1907 (尼姆博弈)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1907 Problem Description Little John is playing very ...
- POJ 2234 Matches Game (尼姆博弈)
题目链接: https://cn.vjudge.net/problem/POJ-2234 题目描述: Here is a simple game. In this game, there are se ...
- HDU1907(尼姆博弈)
John Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)Total Submis ...
- POJ 3480 & HDU 1907 John(尼姆博弈变形)
题目链接: PKU:http://poj.org/problem? id=3480 HDU:http://acm.hdu.edu.cn/showproblem.php? pid=1907 Descri ...
- hdu 1907 尼姆博弈
John Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)Total Submis ...
- hdu----(1849)Rabbit and Grass(简单的尼姆博弈)
Rabbit and Grass Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) ...
- hdu 1849(Rabbit and Grass) 尼姆博弈
Rabbit and Grass Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) ...
- Being a Good Boy in Spring Festival 尼姆博弈
Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit Status Descr ...
- HDU 4315 Climbing the Hill (阶梯博弈转尼姆博弈)
Climbing the Hill Time Limit: 1000MS Memory Limit: 32768KB 64bit IO Format: %I64d & %I64u Su ...
随机推荐
- php登陆和注册
注册界面 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF- ...
- java多线线程停止正确方法
//军队线程 //模拟作战双方的行为 public class ArmyRunnable implements Runnable { //volatile保证了线程可以正确的读取其他线程写入的值 // ...
- Arduino 9g舵机操作
一.接线原理图 一.实物图 三.事例代码 从0转180度,再从180转到0度
- apicloud常用分享方法
app中经常会有分享的功能,不管是分享商品还是文字还是图片或者是发送给微信好友扣扣好友,一下做一总结. 分享的样式(分享所有的样式模块):MNActionButton. 在apicloud 中添加这个 ...
- python 生成HTmL报告页面 V1.2
上代码 # -*- coding=utf-8 -*- import time,os #数据部分 func_dict={"funcname":"模块1",} fu ...
- eas之添加表格列宽自动调整设置
设置表格整体宽度自动调整为所在panel的宽度 KDTable table=new KDTable(); table. setAutoResize (boolean); 注意:该功能在冻结功能启用后, ...
- eas之去掉关闭eas页面时校验是否修改的提示
EditUI-------> public boolean checkBeforeWindowClosing() { boolean b = super.checkBefo ...
- 【剑指Offer】59、按之字形顺序打印二叉树
题目描述: 请实现一个函数按照之字形打印二叉树,即第一行按照从左到右的顺序打印,第二层按照从右至左的顺序打印,第三行按照从左到右的顺序打印,其他行以此类推. 解题思路: 这道题仍然是二 ...
- es5、es6函数调用
ES5中函数的4种调用 在ES5中函数内容的this指向和调用方法有关 1 函数调用模式 包括函数名()和匿名函数调用,this指向window function getSum() { console ...
- Java基本类型转换
1.自动类型转换 java所有的数值型变量都可以相互转换,如果系统支持把某种基本类型的值直接付赋给另一个基本类型的变量,则这种方式被称为自动类型转换. 当把一个表数范围小的数值或变量直接赋给另一个表数 ...