FZU 2147A-B Game

来源:互联网 发布:js radio 取得 编辑:程序博客网 时间:2024/06/05 05:52

关键是找出规律,其次再说贪心吧= =

#include <iostream>#include <cstdio>using namespace std;int main(){    int t, cas = 0;    scanf("%d", &t);    while (t--)    {        __int64 a, b;        scanf("%I64d%I64d", &a, &b);        int cnt = 0;        while (a > b)        {            a -= (a % ((a >> 1) + 1));            cnt++;        }        printf("Case %d: %d\n", ++cas, cnt);    }    return 0;}


0 0
原创粉丝点击