[HDU] [2001] Calculate the Distance Between Two Points

Problem Description

Loading...

Problem Analysis

Let’s just go with this…

cpp
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
#include<stdio.h>
#include<math.h>
int main()
{
    double d,x1,y1,x2,y2;
    while(scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2)!=EOF)
    {
    printf("%.2lf\n",d=sqrt(pow(x1-x2,2)+pow(y1-y2,2)));
    }
return 0;
}

Loading...