题目理解出错了 所以花了点时间
/*************************************************************************
> File Name: 573.cpp
> Author: ma6174
> Mail: ma6174@163.com
> Created Time: 2015年10月26日 星期一 14时47分10秒
************************************************************************/
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<iostream>
#include<math.h>
using namespace std;
float h,u,d,f,speed=0;
int day;
int main(){
while(scanf("%f %f %f %f",&h,&u,&d,&f)!=EOF){
if(h==0&&u==0&&d==0&&f==0) break;
day=1;
float sum=0;
float down=u*f/100.0;
speed=u;
while(1){
if(speed>0) sum+=speed;
if(sum>h){
printf("success on day %d\n",day);break;
}
sum-=d;
speed-=down;
if(sum<0){
printf("failure on day %d\n",day);break;
}
day++;
}
}
return 0;
}