eolymp
bolt
Try our new interface for solving problems
Problems

The distance from the point to the segment

The distance from the point to the segment

Given a segment in space (\textbf{x_1}, \textbf{y_1}, \textbf{z_1}) - (\textbf{x_2}, \textbf{y_2}, \textbf{z_2}) and the point (\textbf{x}, \textbf{y}, \textbf{z}). Find the distance from the point to the segment. \InputFile Given integers \textbf{x_1}, \textbf{y_1}, \textbf{z_1}, \textbf{x_2}, \textbf{y_2}, \textbf{z_2}, \textbf{x}, \textbf{y}, \textbf{z}. Coordinates do not exceed \textbf{1000}. \OutputFile Bring out the desired quantity c up at least \textbf{6} digits after the decimal point.
Time limit 1 second
Memory limit 256 MiB
Input example #1
0 0 0 
1 1 1
0 0 1
Output example #1
0.8164965809
Author Stanislav Pak
Source Winter School, Kharkov, 2011, Day 1