十分水,就是数学公式一套就完事儿
import java.util.Scanner;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();//sqrt是java当中的开平方函数double d = Math.sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));//String.format函数控制输出格式,即小数点位数`在这里插入代码片`System.out.println(String.format("%.2f",d));}}
}