zoukankan      html  css  js  c++  java
  • 计算两点间的距离,hdu-2001

    计算两点间的距离

    Problem Description
    输入两点坐标(X1,Y1),(X2,Y2),计算并输出两点间的距离。
     
    Input
    输入数据有多组,每组占一行,由4个实数组成,分别表示x1,y1,x2,y2,数据之间用空格隔开。
     
    Output
    对于每组输入数据,输出一行,结果保留两位小数。
     
    Sample Input
    0 0 0 1
    0 1 1 0
     
    Sample Output
    1.00
    1.41
     
     1 #include<stdio.h>
     2 #include<stdlib.h>
     3 #include<math.h>
     4 int main()
     5 {
     6     double x1,y1,x2,y2,d;
     7     while(scanf("%lf%lf%lf%lf",&x1,&y1,&x2,&y2)!=EOF)//无限次输入两点坐标
     8     {
     9         d=(sqrt)((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));//两点之间距离公式
    10         printf("%.2lf
    ",d);保留两位小数
    11     }
    12 return 0;
    13 } 
  • 相关阅读:
    Postman post csrf_token
    CBV
    nginx+uWSGI+django部署web服务器
    JS绘图
    get_字段_display()
    limit_choices_to
    window.onload=function(){};
    模拟百度搜索项目
    事件冒泡
    解绑事件
  • 原文地址:https://www.cnblogs.com/Eric-keke/p/4376131.html
Copyright © 2011-2022 走看看