UVa 12293 - Box Game Solution

#include <iostream>
using namespace std;
int main(){
    ios::sync_with_stdio(0);
    int n;
    while(cin>>n&&n){
        int tmp=1;
        while(tmp<n){
            tmp<<=1;
            tmp|=1;
        }
        if(tmp==n)
            cout<<"Bob"<<endl;
        else
            cout<<"Alice"<<endl;
    }
}

Comments