题解 | 绕距
绕距
https://www.nowcoder.com/practice/7a245fc6284f4139b4fb21de58e68483
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main() {
int x1, y1, x2, y2;
cin >> x1 >> y1;
cin >> x2 >> y2;
double DM = abs(x1 - x2) + abs(y1 - y2);
double DE = sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2));
double delta = abs(DM - DE);
cout << fixed << setprecision(40) << delta << endl;
}
// 64 位输出请用 printf("%lld")
查看9道真题和解析