Survived
SRM 323 · 2006-10-19 · by Pawa
Problem Statement
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
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.
1 -1 1 1 Returns: 1.0
If you swim directly down (in the negative direction of the y-axis) for one second, you will have gone forward one meter. By that time, the ocean's stream will have taken you one meter in the positive direction of the x-axis, leaving you at point (1, -1).
1 1 1 0 Returns: 1.4142135623730951
1 1 0 1 Returns: -1.0
9 3 2 3 Returns: 2.0593413823019864
-9 3 2 3 Returns: -1.0
Submissions are judged against all 124 archived test cases, of which 5 are shown here. Case numbers match the judge’s.
Language: C++17 · define a public class Survived with a public method double minTime(int x, int y, int V, int U) · 124 test cases · 2 s / 256 MB per case