hdu5591(博弈)
来源:互联网 发布:微创软件怎么样 编辑:程序博客网 时间:2024/06/03 14:14
ZYB’s Game
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 632 Accepted Submission(s): 510
Problem Description
ZYB played a game named NumberBomb with his classmates in hiking:a host keeps a number in [1,N] in mind,then
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].
Input
In the first line there is the number of testcases T.
For each teatcase:
the first line there is one number N.
1≤T≤100000,1≤N≤10000000
Output
For each testcase,print the ans.
Sample Input
1
3
Sample Output
1
这道题,很简单,只要模仿对方就可以了,只有奇数的时候,后手永远模仿先手,所以先手没法赢。
#include<bits/stdc++.h>int main(){ int n,T; scanf("%d",&T); while(T--){ scanf("%d",&n); if(n&1)printf("1\n"); else puts("0"); } return 0;}
- hdu5591(博弈)
- HDU5591 博弈
- HDU5591(博弈)
- HDU5591 - ZYB's Game (简单博弈)
- hdu5591 ZYB's Game
- 博弈入门---(巴什博弈,威佐夫博弈,nim博弈)
- 人机博弈之(一)------博弈介绍
- 人机博弈之(一)------博弈介绍
- (博弈)Public SaleHDU2149(巴什博弈)
- 【博弈】hdu1850 && hdu2176 (尼姆博弈)
- [POJ](2975)Nim ---Nim博弈(博弈)
- bzoj 4131: 并行博弈(博弈)
- 经典博弈(转)
- (转)博弈
- 【POJ2975】Nim (博弈)
- hdu1527(博弈问题)
- POJ-2505(博弈)
- 博弈 (转)
- ip拨号器demo----BroadcastReceiver
- MySQL学习10:外键约束下的更新操作
- 常见电子器件命名规则
- 阻塞队列LinkedBlockingQueue用法
- Eclipse导入git上的maven web项目 部署
- hdu5591(博弈)
- 最大值和所有元素之和
- Snackbar的使用
- ant中的for循环用法
- onvif的soap消息之check
- 启动tomcat闪退,logs中提示元素类型 "Context" 必须由匹配的结束标记 "</Context>" 终止的解决方法
- Run queue of FreeBsd
- poj1465Multiple(经典BFS+余数判重)
- 引用类型——Java数组