就是博弈,简单博弈啊。后面的那位孩纸会尽量切前面那位妹纸切后的小块切~~~ 多有爱!
#include <cstdio>
using namespace std;
int main()
{
long long a,b,x,y;
int T,Icase=0,N;
scanf("%d",&T);
while(T--)
{
scanf("%d",&N);
a=b=0;
while(N--)
{
scanf("%lld%lld",&x,&y);
while(true)
{
if(x==1)
{
b+=y-1;
break;
}
if(y==1)
{
a+=x-1;
break;
}
a++,b++;
x=x>>1;y=y>>1;
}
}
printf("Case %d: ",++Icase);
if(a>b) printf("Alice\n");
else printf("Bob\n");
}
return 0;
}