407231: GYM102700 A Approach

Memory Limit:512 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

A. Approachtime limit per test1 secondmemory limit per test512 megabytesinputstandard inputoutputstandard output

Let's consider The National University of Colombia (UNAL) as a large coordinate plane centered at the most emblematic place of the University, the Che Square.

Two friends are attending classes and now they may need to move in order to attend their next classes. The first of them is currently at a building located at $$$A$$$ and needs to go to the building located at $$$B$$$, the second friend is currently at a building located at $$$C$$$ and needs to go to the building located at $$$D$$$.

They start to move at the same time, both of them move in a straight line and with the same constant speed. If one of them reaches his destination first, he will remain there, while the other one is still moving.

Your task is to find the minimum distance between the two friends during their change of classes.

Input

You are given two lines each of them containing 4 integers separated by spaces. The first line contains $$$A.x$$$, $$$A.y$$$, $$$B.x$$$ and $$$B.y$$$. The second line contains $$$C.x$$$, $$$C.y$$$, $$$D.x$$$ and $$$D.y$$$. The absolute value of each coordinate doesn't exceed $$$10^9$$$.

Output

Output one line containing the answer to the task. Your answer will be considered correct if the absolute or relative error is at most $$$10^{-6}$$$.

ExamplesInput
0 0 1 0
2 0 2 1
Output
1.414213562373
Input
-2 -4 -2 -2
-3 -5 -3 -2
Output
1.000000000000

加入题单

上一题 下一题 算法标签: