zoukankan      html  css  js  c++  java
  • hdu 5591 ZYB's Game

    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
     
    Source
     1 #pragma comment(linker, "/STACK:1024000000,1024000000")
     2 #include<iostream>
     3 #include<cstdio>
     4 #include<cstring>
     5 #include<cmath>
     6 #include<math.h>
     7 #include<algorithm>
     8 #include<queue>
     9 #include<set>
    10 #include<bitset>
    11 #include<map>
    12 #include<vector>
    13 #include<stdlib.h>
    14 #include <stack>
    15 using namespace std;
    16 #define PI acos(-1.0)
    17 #define max(a,b) (a) > (b) ? (a) : (b)  
    18 #define min(a,b) (a) < (b) ? (a) : (b)
    19 #define ll long long
    20 #define eps 1e-10
    21 #define MOD 1000000007
    22 #define N 1000000
    23 #define inf 1e12
    24 int n;
    25 int main()
    26 {
    27    int t;
    28    scanf("%d",&t);
    29    while(t--){
    30       scanf("%d",&n);
    31       if(n%2==1){
    32          printf("1
    ");
    33       }else{
    34          printf("0
    ");
    35       }
    36       
    37    }
    38     return 0;
    39 } 
    View Code
  • 相关阅读:
    关于UITapGestureRecognizer的一些问题
    自定义导航栏返回按钮
    mousewheel滚轮事件 浏览器的写法
    Apache日志不记录图片文件设置方法和来源日志的配置
    redis持久化配置
    haproxy实现负载均衡
    Keepalived高可用软件的安装与配置
    Sublime text2用户自定义配置
    判断各版本的最简写法
    Ubuntu防火墙 UFW 设置
  • 原文地址:https://www.cnblogs.com/UniqueColor/p/5037019.html
Copyright © 2011-2022 走看看