QOJ.ac

QOJ

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

#3008. Rocket Powered Hovercraft

统计

Problem Description

You are programming an autonomous rocket powered hovercraft. The vehicle can travel very, very fast, but turning is difficult. Since it's hovering, it turns by firing directional thrusters, which will turn the vehicle whether it is moving forward or is stationary.

The salt flats on which you're testing have been mapped with a $\text{2D}$ Cartesian grid. The hovercraft starts at location $(0,0)$ on this grid, facing in the positive $X$ direction. Your job is to get the vehicle to another location $(x,y)$ on the flats.

The hovercraft has a fixed ground speed $v$ miles per second and a fixed rate of rotation $w$ radians per second. Due to the power of the rockets both for acceleration and deceleration, it can attain its maximum speed virtually instantaneously, and come to a stop from maximum speed just as quickly. Likewise, it can begin rotating at its fixed rate instantaneously, and stop just as quickly. It can rotate either clockwise or counter-clockwise.

You must figure out the minimum amount of time to get the vehicle to its target. The program which controls the vehicle can start forward motion, stop forward motion, start rotating, and stop rotating, each exactly once. Note that starting/stopping forward movement can be independent of starting/stopping rotation.

Input

Each test case will consist of exactly two lines.

The first line will contain two space-separated integers $x$ and $y$ ($−1,000 \leq x, y \leq 1,000,(x,y)\ne(0,0)$), which indicate the location on the grid mapped onto the flats that you are trying to reach, in units of miles.

The second line of input will contain two space-separated real numbers with exactly two decimal places: $v$ ($0.01 \leq v \leq 10.00$) and $w$ ($0.01 \leq w \leq 10.00$), where $v$ is the fixed speed of travel in miles per second, and $w$ is the fixed rate of rotation in either direction in radians per second.

Output

Output a single real number, which is the minimum amount of time (in seconds) it would take get the hovercraft from $(0,0)$ to $(x,y)$ subject to the constraints. Your answer will be accepted if it is within an absolute error of $10^{−3}$.

Samples

Sample Input 1

20 0
1.00 0.10

Sample Output 1

20.00000000

Sample Input 2

-10 10
10.00 1.00

Sample Output 2

3.14159265

Sample Input 3

0 20
1.00 0.10

Sample Output 3

28.26445910

Sample Input 4

-997 -3
5.64 2.15

Sample Output 4

177.76915187
About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.