计算两点间的距离

http://acm.hdu.edu.cn/showproblem.php?pid=2001

   1 /*written by czk*/
   2 #include <stdio.h>
   3 #include <math.h>
   4 
   5 int main() {
   6     double x1, y1, x2, y2;
   7     while(scanf("%lf%lf%lf%lf", &x1, &y1, &x2, &y2) != EOF)
   8         printf("%.2f\n", sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2)));
   9 }

hdu2001 (2008-06-01 15:37:16由czk编辑)

ch3n2k.com | Copyright (c) 2004-2020 czk.