0封,求调,玄关

P5735 【深基7.例1】距离函数

CCF___NOI @ 2024-10-05 22:08:46

#include<bits/stdc++.h>
using namespace std;
long long n,m,k,w,a1,a2,a3,b1,b2,b3;
double s;
int dis(int x1,int y1,int x2,int y2){
    return sqrt(pow(abs(x1-x2),2)+pow(abs(y1-y2),2));
}
int main(){
    cin>>a1>>b1>>a2>>b2>>a3>>b3;
    s+=dis(a1,b1,a2,b2);
    s+=dis(a1,b1,a3,b3);
    s+=dis(a3,b3,a2,b2);
    printf("%.2lf",s);
    return 0;
}

by goIdie @ 2024-10-05 22:10:35

@CCF___NOI 坐标不一定是整数


by _Vistion_ @ 2024-10-05 22:14:32

double

开根不一定是整数@ CCF___NOI


by Renyaoyao @ 2024-10-05 22:17:09

@CCF__NOI

数据保证,坐标均为实数且绝对值不超过100, 小数点后最多仅有3

仔细读题


by CCF___NOI @ 2024-10-05 22:43:11

@Renyaoyao @YZ_zhang @Renyaoyao 感谢各位大佬相助,将3枚关注奉上


|