题解 | 两点间距离

两点间距离

https://www.nowcoder.com/practice/94712d6f654143379f8ea5847d9d6225

import java.util.*;


class Point {
    int x;
    int y;
    public Point(int x, int y) {
        this.x = x;
        this.y = y;
    }
}


public class Solution {
    /**
     * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
     *
     * 计算A点与B点之间的距离
     * @param point_A Point类 A点
     * @param point_B Point类 B点
     * @return double浮点型
     */
    public double calculateDistance (Point point_A, Point point_B) {
        // write code here
        double s = Math.sqrt((point_A.x-point_B.x)*(point_A.x-point_B.x)+(point_A.y-point_B.y)*(point_A.y-point_B.y));
        return s;
    }
}

全部评论
点赞 回复 分享
发布于 01-26 15:52 山东

相关推荐

七牛云头号黑子:人家是过度包装被看出来没过简历,你是包都不包啊兄弟
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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