import java.util.Scanner; import java.text.DecimalFormat; 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(); double sum= (x1-x2)*(x1-x2)+(y1-y2)*(y1-y2); DecimalFormat df2 = new DecimalFormat("###.00"); System.out.println(df2.format( Math.sqrt(sum))); } } }
杭电 2001 ( 计算两点间的距离 ) java
最新推荐文章于 2021-02-28 10:04:31 发布