其他分享
首页 > 其他分享> > 2001.计算两点之间的距离--水题

2001.计算两点之间的距离--水题

作者:互联网

import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            double x1 = sc.nextDouble();
            double y1 = sc.nextDouble();
            double x2 = sc.nextDouble();
            double y2 = sc.nextDouble();
            double temp =Math.sqrt(((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)*1.0));
            System.out.println(String.format("%.2f", temp));
            }
    }
}

标签:水题,double,x2,y1,2001,两点,sc,y2,nextDouble
来源: https://www.cnblogs.com/cznczai/p/11148010.html