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
  • 相关阅读:
    2009年信息技术十大趋势
    转:ASP.NET MVC 第五个预览版和表单提交场景
    终于在博客园开通了
    与虚拟机Oracle连接出现ora12154问题的解决
    Frame框架页面加载中进度条的实现
    WordPress安装部署
    Xmarks不会关闭了,太好了!
    抠出淘宝的菜单树
    asp.net实现类似MaskTextBox功能
    win2003 64位系统下ODBC连接使用
  • 原文地址:https://www.cnblogs.com/UniqueColor/p/5037019.html
Copyright © 2011-2022 走看看