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
  • 相关阅读:
    昇腾AI处理器软件栈--任务调度器(TS)
    [转]shopnc 版权问题
    关于对接诸葛IO 解决的问题
    Mysql中like查询中存在反斜杠的解决方法
    关于TP,PHP和shopnc 的cookie
    TypeError: document.getElementById(…).submit is not a function解决
    关于图片上传的 相对路径出现问题
    Android 通讯录
    关于kindedit和 Uedit后者兼容前者
    Handler机制
  • 原文地址:https://www.cnblogs.com/UniqueColor/p/5037019.html
Copyright © 2011-2022 走看看