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
  • 相关阅读:
    DEM、DSM、DOM 名词解释
    html checkbox样式美化
    通过Ajax方式上传文件(input file),使用FormData进行Ajax请求
    C# 读取指定文件夹下所有文件
    ASP.NET 实现Base64文件流下载PDF
    Asp.Net使用百度编辑器(ueditor)
    asp.net 伪静态实现(UrlRewritingNet)
    C# 各种类型的转换
    asp.net操作word 配置在IIS上出现的问题
    plupload 上传组件的使用
  • 原文地址:https://www.cnblogs.com/UniqueColor/p/5037019.html
Copyright © 2011-2022 走看看