#include<iostream>
#include<string>
int is_end(double h, double& dis, double n)
{
if(dis > h) return 1;
else
{
dis -= n;
if(dis < 0) return -1;
}
return 0;
}
int main()
{
int i, j, flag, cnt;
double h, d, n, f, dis, e;
while(scanf("%lf%lf%lf%lf", &h, &d, &n, &f) != EOF && h)
{
e = d*f/100;
for(flag=0,dis=cnt=0; !flag; cnt++)
{
if(d-e*cnt >= 0) dis += (d - e*cnt);
flag = is_end(h, dis, n);
}
if(flag == 1) printf("success on day %d\n", cnt);
else if(flag == -1) printf("failure on day %d\n", cnt);
}
return 0;
}
The Snail
最新推荐文章于 2020-07-10 12:47:27 发布