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 }

 

转载于:https://www.cnblogs.com/a1225234/p/5024089.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值