样例不过

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

juchenglin @ 2023-12-24 09:07:13

#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;
int main()
{
    int x1=0,x2=0,x3=0,y1=0,y2=0,y3=0;
    double c1=0,c2=0,c3=0,tot=0;
    cin>>x1>>y1>>x2>>y2>>x3>>y3;
    c1=sqrt(abs(x2-x1)*abs(x2-x1)+abs(y2-y1)*abs(y2-y1));
    c2=sqrt(abs(x2-x1)*abs(x2-x1)+abs(y2-y1)*abs(y2-y1));
    c3=sqrt(abs(x2-x1)*abs(x2-x1)+abs(y2-y1)*abs(y2-y1));
    tot=c1+c2+c3;
    cout<<fixed<<setprecision(2)<<tot;
    cout<<endl;
    return 0;
}

by OIerWu_829 @ 2023-12-24 09:11:34

@juchenglin

试试

c1=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
c2=sqrt((x3-x2)*(x3-x2)+(y3-y2)*(y3-y2));
c3=sqrt((x1-x3)*(x1-x3)+(y1-y3)*(y1-y3));

by juchenglin @ 2023-12-24 09:15:59

80


by OIerWu_829 @ 2023-12-24 09:18:06

Emmmm...

把我代码发你吧,私信。


by juchenglin @ 2023-12-24 09:19:29

ac了,谢谢


|