zoukankan      html  css  js  c++  java
  • 【NYOJ】[101]两点距离

    这里写图片描述

    其实还是和杭电上的那一题一样
    不过我想明白啦
    不用纠结这么多
    想传就传
    任性╭(╯^╰)╮

    #include<stdio.h>
    #include<math.h>
    int main() {
        int T;
        scanf("%d",&T);
        while(T--) {
            double x1,y1,x2,y2;
            scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);
            printf("%.2lf
    ",sqrt(pow(x1-x2,2)+pow(y1-y2,2)));
        }
        return 0;
    }
    

    标程也暂时没想到什么亮点
    不过就当是再欣赏欣赏C++了

    #include<iostream>
    #include<math.h>
    #include<iomanip>
    using namespace std;
    int main() {
        /*freopen("1.txt","r",stdin);
        freopen("2.txt","w",stdout);*/
    
        double x1,x2,y1,y2,m;
        double a;
        cin>>m;
        while(m--) {
            cin>>x1>>y1>>x2>>y2;
            a=sqrt((double)((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)));
            cout.setf(ios::fixed);
            cout<<setprecision(2)<<a<<endl;
        }
        return 0;
    }

    题目地址:【NYOJ】[101]两点距离

  • 相关阅读:
    POJ
    POJ
    POJ
    POJ
    POJ
    ZOJ
    HDU
    python中主要存在的四种命名方式:
    python 中的 赋值 浅拷贝 深拷贝
    python中sorted方法和列表的sort方法使用
  • 原文地址:https://www.cnblogs.com/BoilTask/p/12569852.html
Copyright © 2011-2022 走看看