题解 | 绕距

绕距

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")

全部评论

相关推荐

想run的马里奥在学...:这个学历帮你扫平百分之80的障碍,投就完了,这会找不到就等3月暑期一样能找到
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务