解题思路:Math.sqrt()方法
注意事项:
参考代码:import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
double Xa = sc.nextDouble();
double Ya = sc.nextDouble();
double Xb = sc.nextDouble();
double Yb = sc.nextDouble();
double l = (Xa-Xb)*(Xa-Xb)+(Ya-Yb)*(Ya-Yb);
System.out.printf("%.3f",Math.sqrt(l));
}
}
0.0分
0 人评分