HRBUST

来源:互联网 发布:sap hana数据库 编辑:程序博客网 时间:2024/04/30 00:15
给出两个点的坐标,求两点距离。
Input
第一行一个整数T,代表有T组测试数据。每组测试数据输入4个浮点数,x1,y1, x2, y2代表点的坐标。
Output
输出两点距离,保留小数点后面2位。
Sample Input
1
0 3 4 0
Sample Output

5.00

//// Created by liyuanshuo on 2017/2/26.//#include <iostream>#include <cstdlib>#include <cstdio>#include <cmath>using namespace std;int main3(){    int n;    float x1, x2, y1, y2;    cin>>n;    while ( n-- )    {        cin>>x1>>y1>>x2>>y2;        float ans = sqrt( pow((x1-x2), 2)+ pow((y1 - y2), 2));        printf("%.2lf\n", ans);    }    return 0;}


0 0