您的位置:首页 > 其它

水题 Codeforces Round #105 (Div. 2) B. Escape

2015-07-18 12:55 197 查看
题目传送门

 /*
水题:这题唯一要注意的是要用double,princess可能在一个小时之内被dragon赶上
*/
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <map>
using namespace std;

const int MAXN = 1e4 + 10;
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) == 5)
{
if (vd <= vp)   puts ("0");
else
{
double cur = vp * t;   double d = 0;
int cnt = 0;
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 = 0;
cnt++;
}
else
{
cur += vp;  d += vd;
}
}

printf ("%d\n", cnt);
}
}

return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: