Problem H
Computer, compute!
You likely know the Euclidean distance formula – the formula to find the distance $d$ between two points, $(x_1, y_1)$ and $(x_2, y_2)$, in a plane.
The formula is $d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}$
You will take the two integer coordinates as input and compute the distance between them.
Hint: You can use the sqrt function in the math module.
Input
Input consists of four lines. The first line consists of one integer $x_1$, the $x$-coordinate of the first point. The second line consists of one integer $y_1$, the $y$-coordinate of the first point. The third line consists of one integer $x_2$, the $x$-coordinate of the second point. The fourth line consists of one integer $y_2$, the $y$-coordinate of the second point. It is guaranteed that $-10\, 000 \leq x_1, y_1, x_2, y_2 \leq 10\, 000$.
Output
Output one line with one floating point number $d$, the Euclidean distance between the two points. The output number should have an absolute or relative error of at most $10^{-9}$.
Sample Input 1 | Sample Output 1 |
---|---|
-5 -5 -11 -13 |
10.000000000000000 |
Sample Input 2 | Sample Output 2 |
---|---|
0 0 0 0 |
0.000000000000000 |
Sample Input 3 | Sample Output 3 |
---|---|
1 1 5 4 |
5.000000000000000 |
Sample Input 4 | Sample Output 4 |
---|---|
3 4 3 4 |
0.000000000000000 |
Sample Input 5 | Sample Output 5 |
---|---|
4 -3 -5 9 |
15.000000000000000 |
Sample Input 6 | Sample Output 6 |
---|---|
7 20 12 8 |
13.000000000000000 |