
http://poj.org/problem?id=2484
1和2时Alice必胜,3时Bob必胜,其他情况下Bob只需要在Alice取过之后取一次将剩下的硬币链平均分为两份,然后Alice怎么取Bob对称着取就可以了。
真是巧妙。
代码
#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 ;
}