标签:
Description

Input
Output
Sample Input
2 3 4 0
Sample Output
Alice Bob Alice
Hint
无
解题思路:通过从1,1为必败态往大数据推算,可以推出,当n为2^m-1时,先手输。
#include<stdio.h>
using namespace std;
bool judge(int x){
int cnt=0;
while(x){
if(x&1)
cnt++;
x>>=1;
}
if(cnt==1)
return false;
else
return true;
}
int main(){
int n;
while(scanf("%d",&n)!=EOF&&n){
if(judge(n+1)){
printf("Alice\n");
}else{
printf("Bob\n");
}
}
return 0;
}
标签:
原文地址:http://www.cnblogs.com/chengsheng/p/4476452.html