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 ...
随机推荐
- hadoop之hdfs学习
简介 HDFS(Hadoop Distributed File System )Hadoop分布式文件系统.是根据google发表的论文翻版的.论文为GFS(Google File System)Go ...
- 小测试 php代理,nginx代理,直接访问对比
#php proxy total sent request num: 507 total handle read times: 506 506 fetches, 2 max parallel, 2.7 ...
- win7 ie10输入网址显示无法显示此页问题的解决
忽然又一天,非常奇怪,所有的浏览器都无法访问网页,直接输入IP也是不行. 本人试过各种方法,包括用360进行修复:清除%temp%下文件:看是否设错了dns, 升级和修复IE,重新注册ie相关的dll ...
- js浮点数精度问题
大多数语言在处理浮点数的时候都会遇到精度问题,但是在JS里似乎特别严重,来看一个例子 alert(45.6*13); 结果居然是592.800000000001,当然加法之类的也会有这个问题 那这是j ...
- Linux系统环境变量的四个配置文件的关系
Linux系统环境变量配置有四个文件分别是: /etc/environment,/etc/profile,/etc/bash.bashrc,~/.bashrc 各配置文件意义 /etc/environ ...
- MacOS Apache配置
仅适用于apache 2.2版本 查看版本 sudo apachectl -v 启动服务器 sudo apachectl start 打开localhost,可以看到内容为“It works! ...
- Oracle中对时间操作的一些总结
sysdate+(5/24/60/60) 在系统时间基础上延迟5秒 sysdate+5/24/60 在系统时间基础上延迟5分钟 sysdate+5/24 在系统时间基础上延迟5小时 sysdate+5 ...
- php 前端获取数据
<pre name="code" class="python"><!doctype html> <html lang=" ...
- 迭代器(iterators)
1.迭代器的概念 迭代器是一种抽象的设计概念.在设计模式中,迭代器模式定义为:提供一种方法,使之能够依序访问某个容器中所含的各个元素,而又无需暴露该容器的内部组织结构. 迭代器可以看做一种行为类似指针 ...
- WebRTC学习笔记_Demo收集
1. WebRTC学习 1.1 WebRTC现状 本人最早接触WebRTC是在2011年底,那时Google已经在Android源代码中增加了webrtc源代码,放在/external/w ...