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\n");
25         else printf("0\n");
26     }
27     return 0;
28 }

 

posted @ 2015-12-06 18:58  御心飞行  阅读(149)  评论(0编辑  收藏  举报