Skip to content

Latest commit

 

History

History
42 lines (31 loc) · 842 Bytes

Ex_1_2_01.md

File metadata and controls

42 lines (31 loc) · 842 Bytes
title date draft tags categories
算法4 Java解答 1.2.01
2019-06-17 07:35:21 +0800
false
JAVA
技术
归档

1.2.01

问题:

Write a Point2D client that takes an integer value N from the command line, generates N random points in the unit square, and computes the distance separating the closest pair of points.

编写一个Point2D用例,命令行接受一个参数N。在单位正方形中生成N个随机点,然后计算两点之间的最近距离。

分析:

2019-06-17-004

    int N = 5; // generates 5 pts
    minDist(N);
//    0 2 0.838
//    0 3 0.936
//    0 4 0.423
//    1 2 0.432
//    1 3 0.647
//    1 4 0.109
//    2 3 0.505
//    2 4 0.453
//    3 4 0.740
//    Min distance is 0.109

参考: