您的位置:首页 > 其它

浙江财经大学第14届校赛 D (Disport with Jelly) 博弈

2018-03-24 20:51 323 查看


【博弈】
题意:  知道L,R 和x    明确知道x的位置,  两个人 谁去到x 谁就lose
   选择
k  >x   R=K-1  

k  <x   L=k+1
k =x  lose 

必输的 状态为   1,2,3   x=2 时  夹击 状态,     1,2,3,4,5  x=3 时  夹击状态
必赢  1,2    x=1 | x=2       1,2,3,4    无论x= 多少 都是必赢
当L,R 放大时  都可以 归结到上述情况, 故  可发现 当 L,R 长度为奇数 时 中间状态必lose  其余一定win

【code】#include <iostream>
#include <bits/stdc++.h>

using namespace std;

int main()
{
int t;
scanf("%d",&t);
int cot=0;
while(t--)
{
int l,r,x;
scanf("%d %d %d",&l,&r,&x);
if((l-r+1)%2==0)
{
printf("Case #%d: Alice\n",++cot);
}
else
{
if((l+r)/2==x)
printf("Case #%d: Bob\n",++cot);
else
printf("Case #%d: Alice\n",++cot);
}
}
return 0;
}
    

123
Disport with Jelly
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: