题解 | 绕距
绕距
https://www.nowcoder.com/practice/7a245fc6284f4139b4fb21de58e68483
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main()
{
float x1,x2,y1,y2,de,dm,rj;
cin>>x1;cin>>y1;
cin>>x2;cin>>y2;
de=sqrt(pow(x1-x2,2)+pow(y1-y2,2));//pow(a,b),引用cmath的幂函数,b为次方
dm=abs(x1-x2)+abs(y1-y2);//abs()为绝对值函数,引用自cmath
rj=abs(dm-de);
cout<<setiosflags(ios::fixed)<<setprecision(10)<<rj;
return 0;
}

