杭电1049

/*********************************
* 日期:2011-3-17
* 作者:SJF
* 题号:杭电1049
* 题目:Climbing Worm
* 结果:AC
* 题意:
* 总结:
**********************************/
#include<stdio.h>
int main()
{
int n,u,d;
while(scanf("%d %d %d",&n,&u,&d)!=EOF)
{
int height=0,time=0;
if(n==0&&u==0&&d==0)
{
break;
}
while(height+u<n)
{
height+=u-d;
time+=2;
}
if(height+u>=n)
{
time++;
}
printf("%d\n",time);
}
}

你可能感兴趣的:(杭电)