CF5D.Follow Traffic Rules
提高+/省选-
通过率:0%
时间限制:1.00s
内存限制:64MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Everybody knows that the capital of Berland is connected to Bercouver (the Olympic capital) by a direct road. To improve the road's traffic capacity, there was placed just one traffic sign, limiting the maximum speed. Traffic signs in Berland are a bit peculiar, because they limit the speed only at that point on the road where they are placed. Right after passing the sign it is allowed to drive at any speed.
It is known that the car of an average Berland citizen has the acceleration (deceleration) speed of a km/h2, and has maximum speed of v km/h. The road has the length of l km, and the speed sign, limiting the speed to w km/h, is placed d km (1 ≤ d < l) away from the capital of Berland. The car has a zero speed at the beginning of the journey. Find the minimum time that an average Berland citizen will need to get from the capital to Bercouver, if he drives at the optimal speed.
The car can enter Bercouver at any speed.
众所周知,贝兰德首都与贝尔库弗(奥运首都)之间由一条直达公路相连。为了提升该公路的通行能力,公路上仅设置了一个限速交通标志。贝兰德的交通标志略显特殊:它仅在标志所处的公路位置起限速作用;车辆刚驶过该标志后,即可任意加速。
已知一位普通贝兰德市民所驾驶汽车的加速度(减速度)为 a km/h²,最大速度为 v km/h。该公路全长 l km,限速标志设于距贝兰德首都 d km 处(满足 1≤d<l),将车速限制为 w km/h。汽车从旅程起点(首都)出发时初速度为 0。若驾驶员以最优速度行驶,求其从首都抵达贝尔库弗所需的最短时间。
汽车可以以任意速度进入贝尔库弗。
输入格式
The first line of the input file contains two integer numbers a and v (1 ≤ a, v ≤ 10000). The second line contains three integer numbers l, d and w (2 ≤ l ≤ 10000; 1 ≤ d < l; 1 ≤ w ≤ 10000).
输入文件的第一行包含两个整数 a 和 v(1 ≤ a,v ≤ 10000)。第二行包含三个整数 l、d 和 w(2 ≤ l ≤ 10000;1 ≤ d < l;1 ≤ w ≤ 10000)。
输出格式
Print the answer with at least five digits after the decimal point.
答案需保留至少五位小数。
输入输出样例
输入#1
1 1 2 1 3
输出#1
2.500000000000
输入#2
5 70 200 170 40
输出#2
8.965874696353
输入解题思路,AI测评打分。不知道怎么写?