首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

hdu3544 Alice's Game-博弈 贪心

2012-09-10 
hdu3544Alices Game----博弈贪心Alices GameTime Limit: 2000/2000 MS (Java/Others)Memory Limit: 65535

hdu3544 Alice's Game----博弈 贪心

Alice's GameTime Limit: 2000/2000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)
Total Submission(s): 232    Accepted Submission(s): 95


Problem DescriptionInputOutputSample InputSample OutputAuthorSourceRecommend#include<iostream>#include<cstdlib>#include<stdio.h>#define ll __int64using namespace std;int main(){ int t,n; int count=1; scanf("%d",&t); while(t--) { scanf("%d",&n); ll x,y; ll c1=0,c2=0; for(int i=1;i<=n;i++) { scanf("%I64d%I64d",&x,&y); while(x>1&&y>1) { x>>=1;y>>=1; c1++;c2++; } if(x==1) c2+=y-1; else c1+=x-1; } printf("Case %d: ",count++); if(c1>c2) puts("Alice"); else puts("Bob"); }}


 

热点排行