题目传送门

 /*
水题:这题唯一要注意的是要用double,princess可能在一个小时之内被dragon赶上
*/
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <map>
using namespace std; const int MAXN = 1e4 + ;
const int INF = 0x3f3f3f3f; int main(void) //Codeforces Round #105 (Div. 2) B. Escape
{
//freopen ("B.in", "r", stdin); double vp, vd, t, f, c;
while (scanf ("%lf%lf%lf%lf%lf", &vp, &vd, &t, &f, &c) == )
{
if (vd <= vp) puts ("");
else
{
double cur = vp * t; double d = ;
int cnt = ;
while (cur < c)
{
if (cur + vp <= d + vd)
{
double time = (cur - d) / (vd - vp);
if (cur + time * vp >= c) break;
cur += vp * (time + (d + vd * time) / vd + f); d = ;
cnt++;
}
else
{
cur += vp; d += vd;
}
} printf ("%d\n", cnt);
}
} return ;
}
05-11 14:07