Given n points in the plane that are all pairwise distinct, a “boomerang” is a tuple of points (i, j, k)
such that the distance between i
and j
equals the distance between i
and k
(the order of the tuple matters).
Find the number of boomerangs. You may assume that n will be at most 500 and coordinates of points are all in the range [-10000, 10000] (inclusive).
给定平面中的n个点都是成对不同的,“回旋镖”是点(i,j,k)的元组,使得i和j之间的距离等于i和k之间的距离(元组的顺序很重要))。
找到飞去来器的数量。 您可以假设n最多为500,点的坐标都在[-10000,10000](含)范围内。
Example:
Input:
[[0,0],[1,0],[2,0]]
Output:
2
Explanation:
The two boomerangs回力镖 are [[1,0],[0,0],[2,0]] and [[1,0],[2,0],[0,0]]