QOJ.ac

QOJ

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

#3008. 火箭动力气垫船

Statistics

你正在为一辆自动火箭动力气垫船编写程序。该载具可以行驶得非常非常快,但转向很困难。由于它是悬浮的,它通过点火方向推进器来转向,无论载具是在向前移动还是静止,推进器都能使其转向。

你测试所在的盐滩已被绘制成一个 $\text{2D}$ 笛卡尔坐标网格。气垫船从该网格上的位置 $(0,0)$ 出发,面向正 $X$ 方向。你的任务是将载具移动到盐滩上的另一个位置 $(x,y)$。

该气垫船具有固定的地面速度 $v$(英里/秒)和固定的旋转速率 $w$(弧度/秒)。由于火箭在加速和减速方面动力强劲,它几乎可以瞬间达到最大速度,也能同样迅速地从最大速度停止。同样,它可以瞬间开始以固定速率旋转,并同样迅速地停止。它可以顺时针或逆时针旋转。

你必须计算出将载具移动到目标位置所需的最短时间。控制载具的程序可以分别启动前进、停止前进、开始旋转和停止旋转,每项操作恰好执行一次。注意,开始/停止前进运动可以与开始/停止旋转独立进行。

输入格式

每个测试用例包含恰好两行。

第一行包含两个用空格分隔的整数 $x$ 和 $y$ ($-1,000 \leq x, y \leq 1,000, (x,y) \neq (0,0)$),表示你试图到达的网格坐标位置,单位为英里。

第二行输入包含两个用空格分隔的实数,且均保留两位小数:$v$ ($0.01 \leq v \leq 10.00$) 和 $w$ ($0.01 \leq w \leq 10.00$),其中 $v$ 是固定的行驶速度(英里/秒),$w$ 是向任一方向旋转的固定速率(弧度/秒)。

输出格式

输出一个实数,表示在满足约束条件下,气垫船从 $(0,0)$ 到达 $(x,y)$ 所需的最短时间(秒)。如果你的答案与标准答案的绝对误差在 $10^{-3}$ 以内,则会被接受。

样例

样例输入 1

20 0
1.00 0.10

样例输出 1

20.00000000

样例输入 2

-10 10
10.00 1.00

样例输出 2

3.14159265

样例输入 3

0 20
1.00 0.10

样例输出 3

28.26445910

样例输入 4

-997 -3
5.64 2.15

样例输出 4

177.76915187

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.