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 ...
随机推荐
- CAGradientLayer 颜色渐变实现进度条
#import <UIKit/UIKit.h> @interface TJGradientProgressView : UIView /** * 进度值 */ @property(nona ...
- CSS3 3D变换实例 滚动的正方体
笔记: 2D变换 transform 位移 translateX() translateY() 简写:translate(X值,Y值) 正值向右,负值向左 旋转 rotate() rotat ...
- OC对象的本质及分类
Object-C的底层都是通过C/C++来实现的,所以OC中的对象也会转化成C/C++中的某一个数据结构, 我们在终端里通过指令 xcrun -sdk iphoneos clang -arch arm ...
- 《Linux程序设计》笔记(二)shell程序设计
1. 进程树形显示 ps -e f 2. 重定向 > 覆盖文件 >> 附加至文件 1> 标准输出 2> 标准错误输出 0 代表一个程序的标准输入 3. 程序可以在当前目录 ...
- Hadoop多节点Cluster
Hadoop多节点集群规划 服务起名称 内网IP HDFS YARN master 192.168.1.155 NameNode ResourceManager slave1 192.168.1.11 ...
- POJ_2115_扩展欧几里德
C Looooops Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 23673 Accepted: 6540 Descr ...
- iOS安全策略之HTTPS
1.HTTPS传输流程 2.常用加密算法 3.AFN证书校验策略及核心方法 4.SSL Pinning 5.CA证书申请流程 HTTPS经由超文本传输协议进行通信,但利用SSL/TLS来对数据包进行加 ...
- Content-Encoding与Content-Type的区别
RFC 2616 for HTTP 1.1 specifies how web servers must indicate encoding transformations using the Con ...
- Redis 之set集合结构及命令详解
注:集合的元素具有唯一性,无序性 1.sadd key value1 value2 添加一个集合 2.smembers key 获取一个集合的所有值 3.srem key valu ...
- vue 登录验证码
vue 登录验证码 最近在开发pc端项目,配合elementui使用 createCode() { var code = ""; var codeLength = 4; //验证码 ...