水题 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; }
相关文章推荐
- Eclipse中离线安装ADT插件详细教程
- 自定义cell 3
- C语言中内存分布及程序运行中(BSS段、数据段、代码段、堆栈)
- 链表基本操作的实现
- 《开源分享2》:《开源框架实战宝典电子书V1.0.0》完整版!
- 用c#开发微信 (21) 微信酒店预订系统
- 行业分析已经过时
- centos安装openswan
- Python字典key值查询效率低的问题
- (转)继承、重载、覆盖、多态
- 8.19! 今天我有18生日,点击阅读或顶部 尾随幸运的一天!生日知识!↓——【Badboy】
- FZU2072——二分——Count
- [LyncServer2013企业版迁移SkypeForBusinessServer2015企业版]三,部署新前端服务器
- 管理类敏捷实践
- 炼数成金(原 itpub 培训)
- 7月拍牌记
- HBase,Redis
- fonts.googleapis.com, ajax.googleapis.com加载缓慢的解决方法
- 谈谈我对这行业看法
- 机器学习之开源库