1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-11 19:18:14 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/回旋镖的数量 [number-of-boomerangs].html

39 lines
1.4 KiB
HTML
Raw Normal View History

2022-03-27 20:52:13 +08:00
<p>给定平面上<em>&nbsp;</em><code>n</code><em> </em><strong>互不相同</strong> 的点&nbsp;<code>points</code> ,其中 <code>points[i] = [x<sub>i</sub>, y<sub>i</sub>]</code><strong>回旋镖</strong> 是由点&nbsp;<code>(i, j, k)</code> 表示的元组 ,其中&nbsp;<code>i</code>&nbsp;&nbsp;<code>j</code>&nbsp;之间的距离和&nbsp;<code>i</code>&nbsp;&nbsp;<code>k</code>&nbsp;之间的欧式距离相等(<strong>需要考虑元组的顺序</strong>)。</p>
<p>返回平面上所有回旋镖的数量。</p>
&nbsp;
<p><strong>示例 1</strong></p>
<pre>
<strong>输入:</strong>points = [[0,0],[1,0],[2,0]]
<strong>输出:</strong>2
<strong>解释:</strong>两个回旋镖为 <strong>[[1,0],[0,0],[2,0]]</strong><strong>[[1,0],[2,0],[0,0]]</strong>
</pre>
<p><strong>示例 2</strong></p>
<pre>
<strong>输入:</strong>points = [[1,1],[2,2],[3,3]]
<strong>输出:</strong>2
</pre>
<p><strong>示例 3</strong></p>
<pre>
<strong>输入:</strong>points = [[1,1]]
<strong>输出:</strong>0
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>n ==&nbsp;points.length</code></li>
<li><code>1 &lt;= n &lt;= 500</code></li>
<li><code>points[i].length == 2</code></li>
<li><code>-10<sup>4</sup> &lt;= x<sub>i</sub>, y<sub>i</sub> &lt;= 10<sup>4</sup></code></li>
<li>所有点都 <strong>互不相同</strong></li>
</ul>