#include<stdio.h>
int main()
{
float H,U,D,F,h,a;
int count;
while(scanf("%f%f%f%f",&H,&U,&D,&F)==4)
{
if(H==0)
{
break;
}
count=0;
a=F/100.0;
a=a*U;
h=0.0;
while(1)
{
count++;
if(U<0)
{
U=0;
}
h=h+U;
if(h>H)
{
break;
}
U=U-a;
h=h-D;
if(h<0)
{
break;
}
}
if(h<0)
{
printf("failure on day %d\n",count);
}
else
{
printf("success on day %d\n",count);
}
}
return 0;
}
int main()
{
float H,U,D,F,h,a;
int count;
while(scanf("%f%f%f%f",&H,&U,&D,&F)==4)
{
if(H==0)
{
break;
}
count=0;
a=F/100.0;
a=a*U;
h=0.0;
while(1)
{
count++;
if(U<0)
{
U=0;
}
h=h+U;
if(h>H)
{
break;
}
U=U-a;
h=h-D;
if(h<0)
{
break;
}
}
if(h<0)
{
printf("failure on day %d\n",count);
}
else
{
printf("success on day %d\n",count);
}
}
return 0;
}
0 comments: (+add yours?)
Post a Comment