QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 512 MB Total points: 100

#7331. 麦田里的守望者

Statistics

作为一名经验丰富的慢跑者,你决定抄近路穿过一片矩形谷物田,这片田地被垂直划分为三块区域,分别种着黑麦、小麦和大麦。你想要从田地的左下角走到右上角。

慢跑的技巧取决于你所踩踏的谷物种类。因此,你将以三种可能不同的速度穿过这些区域。你可以自由规划你的路线(但不能离开田地范围)。

请计算从左下角到达右上角所需的最短时间。

输入格式

输入的第一行包含测试用例的数量 $z$ ($1 \le z \le 10\,000$)。接下来是各测试用例的描述。

每个测试用例占一行,包含七个整数 $h, a, b, c, v_a, v_b, v_c$ ($1 \le h, a, b, c, v_a, v_b, v_c \le 10^5$):矩形田地的高度,三块区域的宽度,以及在这些区域中允许的速度。速度 $v$ 表示你单位时间内移动的距离恰好为 $v$。

输出格式

对于每个测试用例,输出从左下角到达右上角所需的总时间。如果你的答案与正确答案的误差不超过 $10^{-3}$,则视为正确。

样例

输入 1

2
10 3 4 3 1 1 1
21 5 12 4 4 3 4

输出 1

14.14213562
8.75

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.