Calculate the distance between two points
Time limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others)
Total submission (s): 254764 Accepted Submission (s): 88773
Problem description Inputs two point coordinates (X1,Y1), (X2,y2), calculates and outputs the distance between two points.
Input data has more than one group, each group of one row, consisting of 4 real numbers, representing X1,y1,x2,y2, separated by a space between the data.
Output outputs a row for each set of input data, and the result retains two decimal places.
Sample Input0 0 0 10 1 1 0
Sample Output1.001.41
1#include <iostream>2#include <cstdio>3#include <cmath>4 using namespacestd;5 intMain ()6 {7 DoubleX1,x2,y1,y2;8 while(CIN >> x1 >> y1 >> x2 >>y2)9 {Ten Doubledis = sqrt ((x2-x1) * (x2-x1) + (y2-y1) * (y2-y1)); Oneprintf"%.2f\n", dis); A } - return 0; -}
hdu2001 calculate the distance between two points "C + +"