#include<iostream>
#include<cstdio>
#include<cstdlib>
using namespace std;
int main()
{
int h,u,d,f,i;
float H,U,F;
//freopen("in.txt","r",stdin);
while(scanf("%d%d%d%d",&h,&u,&d,&f)&&h)
{
F=float(u*f)/100;
H=0;U=u;
for(i=1;;i++)
{
H+=U;
U-=F;
if(U<0)U=0;
if(H>h)
{
cout<<"success on day "<<i<<endl;
break;
}
else
H-=d;
if(H<0)
{
cout<<"failure on day "<<i<<endl;
break;
}
}
}
exit(0);
}
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.