HDU 1049 Climbing Worm

#include <cstdio>
int main()
{
    int cnt,h,d,u;
    while(scanf("%d%d%d",&h,&d,&u)!=EOF)
    if (h!=0)
    {
        cnt=0;
        cnt+=(2*((h-d)/(d-u)));
        if ((h-d)%(d-u)!=0) 
        cnt+=2;
        cnt+=1;
        printf("%d\n",cnt);
    }
    return 0;
}

翻译:worm 虫子

posted @ 2013-12-20 14:55  forever97  阅读(95)  评论(0编辑  收藏  举报