hdu 3544 Alice's Game

链接:http://acm.hdu.edu.cn/showproblem.php?pid=3544

这题被题意坑了, 英语不好的孩子伤不起~

题意: 有一个N*M的蛋糕, 两个人来切, A切完, B从切出来的两块中选一块切,  最后一个不能切的为负;

因此每个人都尽量均分;

View Code
 1 #include <iostream>
 2 #include <cmath>
 3 #include <cstring>
 4 #include <cstdio>
 5 #include <string>
 6 #include <stdlib.h>
 7 #include <algorithm>
 8 using namespace std;
 9 typedef long long LL;
10 const LL Mod= 1e9+7;
11 int T, N,Ca;
12 LL x, y, a, b;
13 int main( )
14 {
15     scanf( "%d", &T );
16     while( T -- ){
17         printf( "Case %d: ", ++Ca ); 
18         scanf( "%d", &N );
19         a=b=0;
20         for( int i=0; i<N; ++i ){
21             scanf("%I64d%I64d", &x, &y ); 
22             while( x>1&&y>1 ){                
23                 x=x>>1;
24                 y=y>>1;
25             }
26             if(x==1) b+=(y-1);
27             else a+=(x-1);
28         }
29         if( a>b )puts("Alice");
30         else puts( "Bob" );
31     } 
32     return 0;
33 }
原文地址:https://www.cnblogs.com/jian1573/p/3051070.html