题解 | 绕距
绕距
https://www.nowcoder.com/practice/7a245fc6284f4139b4fb21de58e68483
#include<bits/stdc++.h>
using namespace std;
double paixu(double a,double b){
return (a>b)? a-b:b-a;
}
int main() {
int a,b,c,d;
cin>>a>>b >>c>>d;
double de,dm;
de=sqrt(pow(a-c,2)+pow(d-b,2));
dm=paixu(a,c)+paixu(b,d);
cout<<fixed<<setprecision(16)<<paixu(de,dm);
return 0;
}
// 64 位输出请用 printf("%lld")

查看1道真题和解析