#include <stdio.h>
#include <stdlib.h> int main()
{
int dayTh;
float Udis,currentHeight,firstClaim,HeightOfWell,downDis,fagtigue;
while(scanf("%f %f %f %f",&HeightOfWell,&Udis,&downDis,&fagtigue)!=EOF){
if(HeightOfWell==)
break;
currentHeight=;
firstClaim=Udis;
dayTh=;
while(){
currentHeight+=Udis;
Udis-=fagtigue/*firstClaim;
if(Udis<)
Udis=;
dayTh++;
if(currentHeight>HeightOfWell){
printf("success on day %d\n",dayTh);
break;
}
else{
currentHeight-=downDis;
if(currentHeight<)
{
printf("failure on day %d\n",dayTh);
break;
}
}
}
}
return ;
}
WA过,注意当Udis<0,Udis=0;变量都赋值成float