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 ...
随机推荐
- ExtJS4.2学习(三)——入门基础
1.怎么给某一组件注册事件? 先画一个组件,然后在控制器中加入对这个组件的处理(包括组件对应的方法调用和方法定义). 2.ExtJS4的提示框和JS的差异: ExtJS4:一步走完程序: JS:让程序 ...
- oracle中区分audit_file_dest, background_dump_dest, core_dump_dest, user_dump_dest
一般在$ORACLE_HOME\admin\{SID}目录下: audit_file_dest = /u01/app/oracle/admin/{SID}/adump ...
- java 数组插入元素
import java.util.Arrays; public class AddArray { public static void main(String[] args) { int[] arr ...
- 少部分手机浏览器对于COOKIE支持不够导致服务端无法读取session的解决方案
相信大家都遇到过这样的问题,有手机浏览器的问题导致服务端SESSION读取不正常,目前在项目中的解决方法是采取H5手机本地存储唯一KEY解决的 代码片段 //定义json格式字符串 var userD ...
- windows下安装testlink
因为项目中一直没有使用任何测试用例管理工具,如果需要的时候都是个人写在的excle里各自保存,因为没有系统的记录当时测试方法和测试用例,每次需要再次测试已有的功能时,因为时间太长,而往往记不得当时是怎 ...
- java 键盘输入多种方法 .(转载)
一.java不像C中拥有scanf这样功能强大的函数,大多是通过定义输入输出流对象.常用的类有BufferedReader,Scanner. 实例程序: 1.利用 Scanner 实现从键盘读入int ...
- MySQL 用户登录与操作执行
一个用户可以不登录进Mysql 数据库,由两方面的因数决定 1.你是谁:也就是mysql 数据库中记录的用户名和密码,在SQL Server数据库,中只要求说明你是谁就可以登录了,可是mysql 不是 ...
- linux服务器在运行210天左右宕机
减小字体 增大字体 作者:错新网 来源:www.cuoxin.com 发布时间:2014-2-25 19:21:32 错新网讯 最近几天,一批linux线上的服务器接连宕机,当时以为是硬件问题 ...
- 转: JS自定义事件的定义和触发(createEvent, dispatchEvent)
四.伪DOM自定义事件 这里的“伪DOM自定义事件”是自己定义的一个名词,用来区分DOM自定义事件的.例如jQuery库,其是基于包装器(一个包含DOM元素的中间层)扩展事件的,既与DOM相关,又不直 ...
- 多名Uber司机被指刷单遭封号 一周薪水为0
昨天,一司机在Uber“司机之家”办公地墙上写了泄愤的话 摄/法制晚报记者 苏妮 司机展示的账单显示,上周的薪水几乎为零,上面用英文标注了“欺诈行为”的字样 摄/法制晚报记者 苏妮 法制晚报讯(记者 ...