qz,0

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

蒟蒻QWQ2008 @ 2020-09-26 17:08:18

#include<bits/stdc++.h>
int main()
{ 
    int x1,x2,x3;
    int y1,y2,y3;
    int s=0;
    scanf("%d%d%d%d%d%d",&x1,&y1,&x2,&y2,&x3,&y3);
    s+=sqrt(abs(pow((x2-x1),2)+pow((y2-y1),2)));
    s+=sqrt(abs(pow((x3-x2),2)+pow((y3-y2),2)));
    s+=sqrt(abs(pow((x3-x1),2)+pow((y3-y1),2)));
    printf("%d",s);
}

by expnoi @ 2020-09-26 17:13:01

输出两位小数


by BotDand @ 2020-09-26 17:24:18

保留两位小数


|