解题思路:
import java.util.Scanner; public class C1172 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(sc.hasNext()){ F(sc.nextDouble(), sc.nextDouble(), sc.nextDouble(), sc.nextDouble()); } sc.close(); } //勾股定理计算两点之间距离 private static void F(double x1, double y1, double x2, double y2){ double rs = Math.sqrt(Math.pow(x1-x2, 2) + Math.pow(y2-y1,2)); System.out.printf("%.2f\n", rs); } }
注意事项:
参考代码:
0.0分
0 人评分