Problem Statement | |||||||||||||
| You have survived a shipwreck and need to swim to the land. You can swim at a speed of at most V meters per second. The ocean's stream moves you with a constant speed of U meters per second. Imagine a Cartesian system of coordinates in which you are at point (0,0), and the ocean's stream moves in the positive direction of the x-axis. You are given four integers x, y, V and U. Return a double representing the minimum time in seconds in which you can reach point (x, y). If this point can't be reached, return -1. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Notes | |||||||||||||
| - | Your return value must have an absolute or relative error less than 1e-9. | ||||||||||||
Constraints | |||||||||||||
| - | x and y will be between -100 and 100, inclusive. | ||||||||||||
| - | U and V will be between 0 and 100, inclusive. | ||||||||||||
Examples | |||||||||||||
| 0) | |||||||||||||
| |||||||||||||
| 1) | |||||||||||||
| |||||||||||||
| 2) | |||||||||||||
| |||||||||||||
| 3) | |||||||||||||
| |||||||||||||
| 4) | |||||||||||||
| |||||||||||||
| 5) | |||||||||||||
| |||||||||||||