POJ 2484 A Funny Game 博弈论 对称博弈

时间:2023-03-10 02:23:29
POJ 2484 A Funny Game 博弈论  对称博弈

http://poj.org/problem?id=2484

1和2时Alice必胜,3时Bob必胜,其他情况下Bob只需要在Alice取过之后取一次将剩下的硬币链平均分为两份,然后Alice怎么取Bob对称着取就可以了。

POJ 2484 A Funny Game 博弈论  对称博弈

真是巧妙。

代码

 #include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<iostream>
#include<map>
using namespace std;
int m;
int main(){
while(~scanf("%d",&m)){
if(!m)break;
if(m<)printf("Alice\n");
else printf("Bob\n");
}
return ;
}