zoukankan      html  css  js  c++  java
  • BC 65 game

    主持人一直某个数字在1到n范围,假设甲乙已经知道,甲先猜乙后,都采用最优策略,主持人说偏大还是偏小,不断缩小范围,问最后乙能会获胜的X的取值的个数。

    如果n为奇数,那么仅当x=n/2乙必然获胜,若为奇数乙不可能获胜。

     1 #include <stdio.h>
     2 #include <string.h>
     3 #include <iostream>
     4 #include <algorithm>
     5 #include <vector>
     6 #include <queue>
     7 #include <set>
     8 #include <map>
     9 #include <string>
    10 #include <math.h>
    11 #include <stdlib.h>
    12 #include <time.h>
    13 using namespace std;
    14 
    15 int main()
    16 {
    17     //freopen("in.txt","r",stdin);
    18     //freopen("out.txt","w",stdout);
    19     int T;
    20     int n;
    21     scanf("%d",&T);
    22     while(T--) {
    23         scanf("%d",&n);
    24         if(n%2 == 1)printf("1
    ");
    25         else printf("0
    ");
    26     }
    27     return 0;
    28 }
  • 相关阅读:
    C++解决单纯形表
    VS2010 MFC Excel(3)
    VS2010 MFC Excel(1)
    VS2010 MFC 读取Excel(2)
    读取数量不定的输入数据
    牛顿插值
    连接数据库
    雅克比迭代
    NOIP模拟 24
    NOIP模拟 23
  • 原文地址:https://www.cnblogs.com/a1225234/p/5024089.html
Copyright © 2011-2022 走看看