ZYB's Game(博弈)
ZYB's Game
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 190 Accepted Submission(s): 162
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
3
#include<iostream>
#include<cstdio>
#include<cmath>
int main(){
int x,T;
scanf("%d",&T);
while(T--){
scanf("%d",&x);
if(x&1)puts("1");
else puts("0");
}
return 0;
}
ZYB's Game(博弈)的更多相关文章
- HDU - 5591 ZYB's Game(博弈)
题意:A和B两人在1~N中选数字.已知1<=X<=N,谁先选中X谁就输.每当一个人选出一个不是X的数,裁判都会说明这个数比X大还是小,与此同时,可选范围随之缩小.已知A先选,求满足能让B赢 ...
- BestCoder Round #65 hdu5591(尼姆博弈)
ZYB's Game Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total ...
- hdu----(1849)Rabbit and Grass(简单的尼姆博弈)
Rabbit and Grass Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) ...
- HDU 5754 Life Winner Bo 组合博弈
Life Winner Bo Problem Description Bo is a "Life Winner".He likes playing chessboard gam ...
- 线段树 - ZYB's Premutation
ZYB has a premutation P,but he only remeber the reverse log of each prefix of the premutation,now he ...
- HDU 2509 Nim博弈变形
1.HDU 2509 2.题意:n堆苹果,两个人轮流,每次从一堆中取连续的多个,至少取一个,最后取光者败. 3.总结:Nim博弈的变形,还是不知道怎么分析,,,,看了大牛的博客. 传送门 首先给出结 ...
- HDU 1907 Nim博弈变形
1.HDU 1907 2.题意:n堆糖,两人轮流,每次从任意一堆中至少取一个,最后取光者输. 3.总结:有点变形的Nim,还是不太明白,盗用一下学长的分析吧 传送门 分析:经典的Nim博弈的一点变形. ...
- 51nod1072(wythoff 博弈)
题目链接: http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1072 题意: 中文题诶~ 思路: 博弈套路是有的, 找np局 ...
- ACM: NBUT 1107 盒子游戏 - 简单博弈
NBUT 1107 盒子游戏 Time Limit:1000MS Memory Limit:65535KB 64bit IO Format: Practice Appoint ...
随机推荐
- Composer Yii2 不设置全局变量 归档安装 Win7
1.下载Composer_installer.phar https://getcomposer.org/composer.phar 重命名为 composer_installer.phar 将文件放 ...
- java计算器
由于自己的实验报告 需要用Java来写一个实验报告.自己本没有怎么学过Java,但是学的话也就认真的学一下,毕竟技术这条路线是技多不压身.于是在网站上找来了一些资料,关于Java到底是干什么的, ...
- Analysis about different methods for reading and writing file in Java language
referee:Java Programming Tutorial Advanced Input & Output (I/O) JDK 1.4+ introduced the so-calle ...
- SVN权限配置
初始化SVN仓库后,里面有以下文件. 其中conf是对授权.认证进行管理的,conf目录里的内容有: passwd设立账户密码: authz权限管理: 假设pwd里有user1,user2两个账户 @ ...
- 用rsync从Linux到Windows远程备份
论 rsync是Linux系统下的数据镜像备份工具,从软件的命名上就可以看出来 了——remote sync.rsync支持大多数的类Unix系统,无论是Linux.Solaris还是BSD上都经过了 ...
- nginx filter
server { listen 80; server_name g.zcdn.com; index index.html; location / { proxy_cache cache_go; pro ...
- 【高级】C++中虚函数机制的实现原理
多态是C++中的一个重要特性,而虚函数却是实现多态的基石.所谓多态,就是基类的引用或者指针可以根据其实际指向的子类类型而表现出不同的功能.这篇文章讨论这种功能的实现原理,注意这里并不以某个具体的编译器 ...
- 升级automake和autoconf
<pre name="code" class="html">zjtest7-redis:/root/soft/json-c-json-c-0.12- ...
- HDU 5818 Joint Stacks(左偏树)
[题目链接] http://acm.hdu.edu.cn/showproblem.php?pid=5818 [题目大意] 给出两个栈A B(初始时为空),有三种操作: push.pop.merge. ...
- NYOJ 14 会场安排问题(也算是经典问题了)
会场安排问题 时间限制:3000 ms | 内存限制:65535 KB 难度:4 描述 学校的小礼堂每天都会有许多活动,有时间这些活动的计划时间会发生冲突,需要选择出一些活动进行举办.小刘的工作就 ...