CF590B.Chip 'n Dale Rescue Rangers
提高+/省选-
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
A team of furry rescue rangers was sitting idle in their hollow tree when suddenly they received a signal of distress. In a few moments they were ready, and the dirigible of the rescue chipmunks hit the road.
We assume that the action takes place on a Cartesian plane. The headquarters of the rescuers is located at point (_x_1, _y_1), and the distress signal came from the point (_x_2, _y_2).
Due to Gadget's engineering talent, the rescuers' dirigible can instantly change its current velocity and direction of movement at any moment and as many times as needed. The only limitation is: the speed of the aircraft relative to the air can not exceed
meters per second.
Of course, Gadget is a true rescuer and wants to reach the destination as soon as possible. The matter is complicated by the fact that the wind is blowing in the air and it affects the movement of the dirigible. According to the weather forecast, the wind will be defined by the vector (v__x, v__y) for the nearest t seconds, and then will change to (w__x, w__y). These vectors give both the direction and velocity of the wind. Formally, if a dirigible is located at the point (x, y), while its own velocity relative to the air is equal to zero and the wind (u__x, u__y) is blowing, then after
seconds the new position of the dirigible will be
.
Gadget is busy piloting the aircraft, so she asked Chip to calculate how long will it take them to reach the destination if they fly optimally. He coped with the task easily, but Dale is convinced that Chip has given the random value, aiming only not to lose the face in front of Gadget. Dale has asked you to find the right answer.
It is guaranteed that the speed of the wind at any moment of time is strictly less than the maximum possible speed of the airship relative to the air.
一群毛茸茸的救援队员正无所事事地坐在他们中空的树屋里,突然收到了求救信号。片刻之后,他们便整装待发,松鼠救援队的飞艇立刻启程出发。
我们假设整个事件发生在笛卡尔平面内。救援队总部位于点 (x1,y1),而求救信号来自点 (x2,y2)。
得益于 gadget 出色的工程才能,救援队的飞艇可在任意时刻、以任意次数瞬间改变其当前速度与运动方向。唯一的限制是:飞艇相对于空气的速度大小不能超过 vmax 米每秒。
当然,gadget 是一名真正的救援者,她希望尽快抵达目的地。但问题变得复杂了——空中正刮着风,且风会影响飞艇的运动。根据天气预报,在接下来的 t 秒内,风速由向量 (vx,vy) 描述;此后,风速将变为 (wx,wy)。这些向量同时给出了风的方向和速度大小。形式化地说,若飞艇位于点 (x,y),其自身相对于空气的速度为零,且此时吹着风 (ux,uy),则经过 Δt 秒后,飞艇的新位置为 (x+ux⋅Δt,y+uy⋅Δt)。
gadget 正忙于驾驶飞艇,因此请 chip 计算:若以最优方式飞行,他们需要多长时间才能抵达目的地?chip 很快就解决了这个问题,但 dale 却坚信 chip 给出的是一个随机数值,目的仅仅是为了在 gadget 面前不丢面子。dale 请你来找出正确的答案。
题目保证:在任意时刻,风速大小严格小于飞艇相对于空气所能达到的最大速度。
输入格式
The first line of the input contains four integers _x_1, _y_1, _x_2, _y_2 (|_x_1|, |_y_1|, |_x_2|, |_y_2| ≤ 10 000) — the coordinates of the rescuers' headquarters and the point, where signal of the distress came from, respectively.
The second line contains two integers
and t (0 < v, t ≤ 1000), which are denoting the maximum speed of the chipmunk dirigible relative to the air and the moment of time when the wind changes according to the weather forecast, respectively.
Next follow one per line two pairs of integer (v__x, v__y) and (w__x, w__y), describing the wind for the first t seconds and the wind that will blow at all the remaining time, respectively. It is guaranteed that
and
.
输入的第一行包含四个整数 x1、y1、x2、y2(满足 ∣x1∣,∣y1∣,∣x2∣,∣y2∣≤10000),分别表示救援总部与求救信号发出位置的坐标。
第二行包含两个整数
和 t(满足 0<v,t≤1000),分别表示花栗鼠飞艇相对于空气的最大速度,以及根据天气预报风向发生变化的时刻。
接下来两行,每行一对整数 (vx,vy) 和 (wx,wy),分别描述前 t 秒内的风速向量,以及此后所有时间内的风速向量。保证有
和
。
输出格式
Print a single real value — the minimum time the rescuers need to get to point (_x_2, _y_2). You answer will be considered correct if its absolute or relative error does not exceed 10 - 6.
Namely: let's assume that your answer is a, and the answer of the jury is b. The checker program will consider your answer correct, if
.
输出一个实数值——救援人员到达点 (x2,y2) 所需的最短时间。若你的答案的绝对误差或相对误差不超过 10−6,则视为正确。
具体而言:假设你的答案为 a,评测组的标准答案为 b。当满足条件
时,评测程序将判定你的答案正确。
输入输出样例
输入#1
0 0 5 5 3 2 -1 -1 -1 0
输出#1
3.729935587093555327
输入#2
0 0 0 1000 100 1000 -50 0 50 0
输出#2
11.547005383792516398
输入解题思路,AI测评打分。不知道怎么写?