您的位置:首页 > 其它

数学专项game_theory:UVa 12293

2013-04-17 22:17 323 查看
无脑的打SG函数表找规律……不难发现当n为2^k-1时,SG函数为0,为先手必败,输出Bob;否则输出Alice。

#include <iostream>
#include <cstdio>
using namespace std;
int n;
int main()
{
freopen("in.txt","r",stdin);
while(cin>>n)
{
if(!n) break;
n++;
int flag=1;
while(n>1)
{
if(n%2==0) n/=2;
else
{
flag=0;
break;
}
}
if(!flag) cout<<"Alice"<<endl;
else cout<<"Bob"<<endl;
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: