#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;
int h, u, d, f;
int main() {
#ifndef ONLINE_JUDGE
freopen("in.txt", "r", stdin);
#endif
while(scanf("%d%d%d%d", &h, &u, &d, &f) == 4 && h) {
h *= 100; u *= 100; d *= 100;
int t = f * u / 100; //速度减少量
int s = 0; //高度
int n = 0; //天数
int v = u; //速度
while(1) {
n ++;
s += v;
if(s > h) {
printf("success on day %d\n", n);
break;
}
v -= t;
if(v < 0) v = 0;
s -= d;
if(s < 0) {
printf("failure on day %d\n", n);
break;
}
}
}
return 0;
}
UVa 573 - The Snail
最新推荐文章于 2017-09-06 14:54:11 发布