杭电 hdu 2001

计算两点间距离:

#include<stdio.h>
#include<cmath>
int main(){
    double a,b,c,d,sum;
    while(scanf("%lf %lf %lf %lf",&a,&b,&c,&d)!=EOF){
        sum=0.0;
        sum=(c-a)*(c-a)+(d-b)*(d-b);
        printf("%.2lf\n",sqrt(sum));
    }
    return 0;
}


你可能感兴趣的:(ACM,HDU,杭电,2001)