2014嘉杰信息杯ACM/ICPC湖南程序设计邀请赛暨第六届湘潭市程序设计竞赛



G,H

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 

using namespace std;

#define REP(a,b,c) for(int a = b; a < c; ++a)
#define MAXN 210

const int MAX_ = 500010;
const int INF = 0x7fffffff;
const int N = 500010;


int dp[MAX_];

void init(){
    int n = 100001;
    dp[0] = 0;
    REP(i, 1, n){
        int tmp, cnt = 0, num = 0;
        tmp = i;
        while(tmp){
            if(tmp%10 == 7)cnt++;
            num++;
            tmp /= 10;
        }
        if(num-cnt<=1)dp[i] = dp[i-1]+1;
        else dp[i] = dp[i-1];
    }
}

int lowbit(int x){return x&(-x);}

bool run(int n, int m){
    if((n&1) && (m&1)){
        return false;
    }
    if(!(n&1) && !(m&1)){
        int cnt;
        cnt = lowbit(n) + lowbit(m);
        if(cnt&1)return true;
        else return false;
    }

    int x;
    if(n&1)x = m;
    else x = n;

    int cnt = lowbit(x) - 1;

    //printf("cnt = %d\n",cnt);
    if(cnt&1)return true;
    else return false;
}

int main(){
    //init();
    int T, s, t, Ca = 1;
    //memset(dp, -1, sizeof dp);
    scanf("%d",&T);
    while(T--){

        scanf("%d%d", &s, &t);
        printf("Case %d: ",Ca++);
        bool flag = run(s, t);
        if(flag){
            printf("Alice\n");
        }
        else printf("Bob\n");
        /*scanf("%d",&s);


        printf("%d\n",dp[s]);*/
    }
    return 0;
}


你可能感兴趣的:(ACMer)