Fork me on GitHub

2001.计算两点之间的距离--水题

import java.util.*;
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 temp =Math.sqrt(((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)*1.0));
			System.out.println(String.format("%.2f", temp));
			}
	}
}
posted @ 2019-07-07 21:45  cznczai  阅读(155)  评论(0编辑  收藏  举报