BestCoder Round #65 hdu5591(尼姆博弈)
ZYB's Game
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 527 Accepted Submission(s): 430
players guess a number in turns,the player who exactly guesses X loses,or the host will tell all the players that
the number now is bigger or smaller than X.After that,the range players can guess will decrease.The range is [1,N] at first,each player should guess in the legal range.
Now if only two players are play the game,and both of two players know the X,if two persons all use the best strategy,and the first player guesses first.You are asked to find the number of X that the second player
will win when X is in [1,N].
For each teatcase:
the first line there is one number N.
1≤T≤100000,1≤N≤10000000
#include<stdio.h>
#include<string.h>
#include<string>
#include<math.h>
#include<algorithm>
#define LL long long
#define PI atan(1.0)*4
#define DD double
#define MAX 110
#define mod 10007
#define dian 1.000000011
using namespace std;
int main()
{
int t,n,m,i,j;
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
if(n%2==0)
printf("0\n");
else
printf("1\n");
}
return 0;
}
BestCoder Round #65 hdu5591(尼姆博弈)的更多相关文章
- 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 ...
- Bestcoder round #65 && hdu 5593 ZYB's Tree 树形dp
Time Limit: 3000/1500 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submissio ...
- Bestcoder round #65 && hdu 5592 ZYB's Premutation 线段树
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submissio ...
- HDU 4315 Climbing the Hill (阶梯博弈转尼姆博弈)
Climbing the Hill Time Limit: 1000MS Memory Limit: 32768KB 64bit IO Format: %I64d & %I64u Su ...
- Light OJ 1393 Crazy Calendar (尼姆博弈)
C - Crazy Calendar Time Limit:4000MS Memory Limit:32768KB 64bit IO Format:%lld & %llu Su ...
- LightOJ 1247 Matrix Game (尼姆博弈)
A - Matrix Game Time Limit:2000MS Memory Limit:32768KB 64bit IO Format:%lld & %llu Submi ...
- Light OJ 1253 Misere Nim (尼姆博弈(2))
LightOJ1253 :Misere Nim 时间限制:1000MS 内存限制:32768KByte 64位IO格式:%lld & %llu 描述 Alice and Bob ar ...
随机推荐
- Protected Member Access
https://msdn.microsoft.com/en-us/library/bcd5672a.aspx 官方的说法The protected keyword is a member access ...
- 面试题_48_to_65_Java 集合框架的面试题
这部分也包含数据结构.算法及数组的面试问题 48) List.Set.Map 和 Queue 之间的区别(答案)List 是一个有序集合,允许元素重复.它的某些实现可以提供基于下标值的常量访问时间,但 ...
- bzoj3571
同样的最小乘积XXX模型,这里显然是二分图带权匹配 我不会写KM……于是写了个费用流,由于是稠密图,会退化到n^4 然后本地跑了56s,交上去过了………………一定是我电脑太慢…… 改天写个KM吧 *; ...
- 安卓表格布局android:collapseColumns,android:shrinkColumns和stretchColumn
TableLayout的行数由开发人员直接指定,即有多少个TableRow对象(或View控件),就有多少行. TableLayout的列数等于含有最多子控件的TableRow的列数.如第一Table ...
- 关于存储过程 output 问题
在游标循环当中给 output 变量赋值报 指定的转换无效 错误必须在存储过程最后再给 output 变量赋值
- 【转】使用 Auto Layout 的典型痛点和技巧
layoutIfNeeded()强制立刻更新布局 原文网址:http://www.jianshu.com/p/0f031606e5f2 官方文档:Auto Layout Guide 加上去年WWDC上 ...
- hdu 3068(最长回文)
题意:容易理解... 思路:可以用扩展kmp来做,但是我还没怎么弄懂,时间复杂度O(n*logn),而manacher算法,第一次听说,代码比较短,不难理解,和扩展kmp有点类似,时间复杂度为:O(n ...
- Jedis的JedisSentinelPool源代码分析
概述 Jedis是Redis官方推荐的Java客户端,更多Redis的客户端可以参考Redis官网客户端列表.Redis-Sentinel作为官方推荐的HA解决方案,Jedis也在客户端角度实现了对S ...
- DBCP连接池原理分析及配置用法
DBCP连接池介绍 ----------------------------- 目前 DBCP 有两个版本分别是 1.3 和 1.4. DBCP 1.3 版本需要运行于 JDK 1.4-1.5 ,支持 ...
- Delphi TRichEdit加载word内容
procedure TForm1.btn6Click(Sender: TObject);var WordApp: Variant; //声明一个word对象beginWordApp := Create ...