447. Number of Boomerangs

Givennpoints in the plane that are all pairwise distinct, a "boomerang" is a tuple of points(i, j, k)such that the distance betweeniandjequals the distance betweeniandk(the order of the tuple matters).

Find the number of boomerangs. You may assume thatnwill be at most500and coordinates of points are all in the range[-10000, 10000](inclusive).

Example:
Input:[[0,0],[1,0],[2,0]]Output:2Explanation:The two boomerangs are[[1,0],[0,0],[2,0]]and[[1,0],[2,0],[0,0]]

这题题意理解半天。。。 问的是点到点距离相同时 他们的排列组合共有多少种。第一, 这个距离不是固定的, 只要从一堆点中找到几个点距离之间相等, 算他们的排列组合综合。

题目不难, 正确理解题意比较难~~~~

447. Number of Boomerangs_第1张图片

你可能感兴趣的:(447. Number of Boomerangs)