15145641

我们只需要知道这个取完模最大是 a / 2 + 1就可以了,不过超时了几次,换了visual C++才过,oj还真是傲娇啊.

#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int main()
{
    int t;
    long long a,b;
    int ca = 0;
    scanf("%d",&t);
    while(t--)
    {
        scanf("%lld %lld",&a,&b);
        int tot = 0;
        while(a > b)
        {
            a = a/2 + 1;
            tot++;
        }
        printf("Case %d: %d\n",++ca,tot);
    }
    return 0;
}

 

posted on 2016-04-30 15:30  icode-xiaohu  阅读(148)  评论(0编辑  收藏  举报