#include <iostream>
using namespace std;
int main ()
{
double h, u, d, f;
while(cin>>h>>u>>d>>f)
{
if(!h)break;
double sum = 0;
int i = 0;
for(i = 0;; i++)
{
double factor = u*f*i*0.01;
if(factor<u)
sum+=(u-factor);
else
sum+=0;
if(sum>h)
break;
else
sum-=d;
if(sum<0)break;
//cout<<"("<<i+1<<")"<<" "<<sum<<endl;
}
if(sum>=h)cout<<"success on day "<<i+1<<endl;
else cout<<"failure on day "<<i+1<<endl;
}
return 0;
}
水题,一遍过。需要提示的地方是:sum=0 || sum =h 不满足条件,必须的sum < 0; sum > h;
09-11
09-11
09-11
09-11
09-11