编程语言
首页 > 编程语言> > ZZULIOJ 1084: 计算两点间的距离(多实例测试),Java

ZZULIOJ 1084: 计算两点间的距离(多实例测试),Java

作者:互联网

1084: 计算两点间的距离(多实例测试)

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

标签:1084,Java,double,ZZULIOJ,cin,x2,y1,y2,nextDouble
来源: https://blog.csdn.net/qq_52792570/article/details/119334821