Calculate the distance between two points
Time Limit: 2000/1000 MS (Java/others) memory limit: 65536/32768 K (Java/Others)
Total submission (s): 94573 accepted submission (s): 36296
Problem description
Input two-point coordinates (x1, Y1), (X2, Y2), calculate and output the distance between two points.
Input
There are multiple groups of input data. Each group occupies one row and consists of four real numbers, representing X1, Y1, X2, and Y2 respectively. Data is separated by spaces.
Output
For each group of input data, a row is output, and the result is retained with two decimal places.
Sample Input
0 0 0 10 1 1 0
Sample output
1.001.41
# Include <stdio. h> # include <math. h> int main () {float X1, Y1, X2, Y2, result; while (scanf ("% F", & X1, & Y1, & X2, & Y2 )! = EOF) {result = SQRT (x1-x2) * (x1-x2) + (y1-y2) * (y1-y2); printf ("%. 2f \ n ", result);} return 0 ;}