import java.text.DecimalFormat;import java.util.Scanner;public class Main { PRivate double x; private double y; public Main(double x, double y) { this.x = x; this.y = y; } public double getDistance(Main p){ double _x = Math.abs(this.x-p.x); double _y = Math.abs(this.y-p.y); return Math.sqrt(_x*_x+_y*_y); } public static void main(String[] args) { Scanner scan = new Scanner(System.in); DecimalFormat df = new DecimalFormat("0.00"); while(true){ String a[] = scan.nextLine().split(" "); double b[] = new double[4]; for(int i=0; i<a.length; ++i) { b[i] = Double.parseDouble(a[i]); } Main p1 = new Main(b[0],b[1]); Main p2 = new Main(b[2],b[3]); System.out.println(df.format(p1.getDistance(p2))); } }}
新闻热点
疑难解答