eolymp
bolt
Try our new interface for solving problems
Problems

Collision balls

Collision balls

The horizontal flat surface rolling two balls of radius \textbf{R} meters each. At the initial time balls are the coordinates of points (\textbf{x_1}, \textbf{y_1}) and (\textbf{x_2}, \textbf{y_2}) and the velocity projections on the coordinate axes \textbf{dx_1} \textbf{dy_\{1 \}}and \textbf{dx_2} \textbf{dy_2} meters per second, respectively. Required to find the time in seconds, after which balls faced, or determine that it will not happen. \InputFile The input file contains the real numbers \textbf{R} \textbf{x_1 y_1 dx_1 dy_1 x_2 y_2 dx_2 dy_2}. \OutputFile Output file must contain a real number - the time before the collision, accurate to \textbf{3} significant digits after the decimal point, or \textbf{−1}, if no collision occurs. \textbf{1 }≤\textbf{ R }≤\textbf{ 1000, -1000 }≤\textbf{ x_1, y_1, dx_1, dy_1, x_2, y_2, dx_2, dy_2 }≤\textbf{ 1000}
Time limit 1 second
Memory limit 64 MiB
Input example #1
5
10 10 0 0
20 20 0 0
Output example #1
-1