来源:https://codeforces.com/contest/29/problem/B

Traffic Lights

A car moves from point A to point B at speed v meters per second. The action takes place on the X-axis. At the distance d meters from A there are traffic lights. Starting from time 0, for the first g seconds the green light is on, then for the following r seconds the red light is on, then again the green light is on for the g seconds, and so on.

The car can be instantly accelerated from 0 to v and vice versa, can instantly slow down from the v to 0. Consider that it passes the traffic lights at the green light instantly. If the car approaches the traffic lights at the moment when the red light has just turned on, it doesn't have time to pass it. But if it approaches the traffic lights at the moment when the green light has just turned on, it can move. The car leaves point A at the time 0.

What is the minimum time for the car to get from point A to point B without breaking the traffic rules?

Input

The first line contains integers ldvgr (1 ≤ l, d, v, g, r ≤ 1000, d < l) — the distance between A and B (in meters), the distance from A to the traffic lights, car's speed, the duration of green light and the duration of red light.

Output

Output a single number — the minimum time that the car needs to get from point A to point B. Your output must have relative or absolute error less than 10 - 6.

Examples

input

Copy

2 1 3 4 5

output

Copy

0.66666667

input

Copy

5 4 3 1 1

output

Copy

2.33333333

翻译:

‎汽车以每秒 ‎‎v‎‎ 米的速度从 A 点移动到 B 点。该操作在 X 轴上发生。在距离A‎‎的d‎‎米处有红绿灯。从时间 0 开始,在前 ‎‎g‎‎ 秒内,绿灯亮起,然后在接下来的 ‎‎r‎‎ 秒内红灯亮起,然后绿灯再次亮‎‎起 g‎‎ 秒,依此类推。‎

‎汽车可以从‎‎0‎‎到‎‎v‎‎立即加速,反之亦然,可以从‎‎v‎‎立即减速到‎‎0‎‎。考虑到它立即通过绿灯处的交通信号灯。如果汽车在红灯刚刚亮起的那一刻接近红绿灯,它没有时间通过它。但是,如果它在绿灯刚刚打开的那一刻接近交通信号灯,它可以移动。汽车在 0 时离开点 A。‎

‎在不违反交通规则的情况下,汽车从A点到B点的最短时间是多少?‎

‎输入‎

‎第一行包含整数 ‎‎l‎‎, ‎‎d‎‎, ‎‎v‎‎, ‎‎g‎‎, ‎‎r‎‎ (‎‎1 ≤ ‎‎l‎‎, ‎‎d‎‎, ‎‎v‎‎, ‎‎g‎‎, ‎‎r‎‎ ≤ 1000, ‎‎d‎‎ < ‎‎l‎‎)A 和 B 之间的距离(以米为单位)、从 A 到红绿灯的距离、车速、绿灯持续时间和红灯持续时间。‎

‎输出‎

‎输出单个数字 — 汽车从 A 点到 B 点所需的最短时间。输出的相对或绝对误差必须小于‎10‎^-6

Traffic Lights(翻译)相关推荐

  1. SGU 103 Traffic Lights 翻译 题解

    103. 交通灯 每个测试点:0.5s 内存限制:4096KB 在Dingilville市城市交通的安排很不寻常,公路连接着路口,在两个不同的路口之间最多有一条公路连接,没有公路会连接一个路口自身.正 ...

  2. CodeForces刷题C语言:Next Test、Spit Problem、Traffic Lights、Reconnaissance、Borze

    记录洛谷刷题C语言 一.Next Test 题面翻译 题面描述 给出 nnn 个互不相同的整数 aia_iai​ ,从小到大找第一个没有出现过的整数. 输入格式 第一行一个正整数 nnn ,之后是 n ...

  3. 【SGU】103. Traffic Lights 最短路

    传送门:[SGU]103. Traffic Lights 题目大意: 在一个N个点M条边的城市里,每个点上有一个交通灯,交通灯亮B.P颜色,在离开始r的时间内交通灯会亮c颜色(c为B.P中的一种),然 ...

  4. signature=23e9377f593aff2d118917dcf0d9f6d0,Turning streams in the traffic lights system

    摘要: Observations of a currently functioning in Poland traffic lights system shows a need for it's mo ...

  5. sgu103: Traffic Lights

    翻译: Dingiville 城市的交通规则非常奇怪,城市公路通过路口相连,两个不同路口之间最多只有一条直达公路.公路的起止点不会是同一路口. 在任意一条公路上顺不同方向走所需时间相同. 每一个路口都 ...

  6. 29 B. Traffic Lights

    题目: 求车通过红绿灯的时间 题解: 若车过d时是绿灯,时间是总路程/速度 若车过d时是红灯,时间是总路程/速度+等红灯时间 代码: #include<iostream> #include ...

  7. 【codeforces 29B】Traffic Lights

    [题目链接]:http://codeforces.com/problemset/problem/29/B [题意] 一辆车; 让从A开到B; 然后速度是v; (只有在信号灯前面才能停下来..否则其他时 ...

  8. TL-SSD: Detecting Traffic Lights by Single Shot Detection 论文复现

    1.按照我上一篇博客安装caffe-ssd; 2.安装开源网站提供的文档替换caffe-ssd,并重新编译caffe. 2.1.安装pycaffe cd caffe-master/python sou ...

  9. SGU 103 Traffic Lights

    http://acm.sgu.ru/problem.php?contest=0&problem=103 有条件限制的最短路问题,当且仅当点的颜色一样时可以通行否则需要等到符合条件时才可以通行. ...

最新文章

  1. Python使用matplotlib可视化绘制并通过Tkinter生成按钮将可视化结果导出为pdf文件
  2. 学习quartz定时
  3. CRM Fiori Application opptListRefreshed
  4. 【设计模式 06】原型模式(克隆??)
  5. Navicat导入Excel表格数据
  6. 转载C#中的特性(Attributes)
  7. 【codevs1282】约瑟夫问题,卡数据ing?
  8. jetty之嵌入式运行jetty
  9. 在fedora20下面手动为自己的安装程序创建桌面图标
  10. ENVI标准库下光谱分析
  11. Spark 基础——RDD 算子
  12. C语言 · 图形输出
  13. 专业绘图(Visio 2016)实战视频课程-专题视频课程
  14. 人脸识别打卡项目(7)
  15. viper4android 2.5正版,VIPER4Android最新版本
  16. java毕业设计菜鸟驿站快递分发系统Mybatis+系统+数据库+调试部署
  17. 使用jib发布代码流程
  18. Python读写矢量数据(1)针对读取矢量数据——Python地理数据处理学习分享
  19. App推广都有哪些渠道?一张图片让你全看明白!
  20. 浏览器中网址访问过程解析

热门文章

  1. TOREX | 具备理想二极管功能的负载开关IC,可抑制备用电池的消耗
  2. Bailian4105 拯救公主【BFS】
  3. window.location以及拆分uri
  4. 热门 UI 组件库离线文档制作教程(iView、Arco Design)
  5. python语言概述_(一)Python从入门到精通之语言简介
  6. Cocos-2dx台球游戏实现
  7. 电脑小白学习第九课---看图软件之美图看看
  8. 大项目之网上书城(三)——主页(中)
  9. 医疗影像图标_您可以下载30种免费的医疗图标集
  10. 跟我一起学scikit-learn22:K-均值算法