mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-10 18:48:13 +08:00
36 lines
1.3 KiB
HTML
36 lines
1.3 KiB
HTML
<p>给你一个由 <strong>不同</strong> 正整数组成的数组 <code>nums</code> ,请你返回满足 <code>a * b = c * d</code> 的元组<em> </em><code>(a, b, c, d)</code><em> </em>的数量。其中 <code>a</code>、<code>b</code>、<code>c</code> 和 <code>d</code> 都是 <code>nums</code> 中的元素,且 <code>a != b != c != d</code> 。</p>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>示例 1:</strong></p>
|
||
|
||
<pre>
|
||
<strong>输入:</strong>nums = [2,3,4,6]
|
||
<strong>输出:</strong>8
|
||
<strong>解释:</strong>存在 8 个满足题意的元组:
|
||
(2,6,3,4) , (2,6,4,3) , (6,2,3,4) , (6,2,4,3)
|
||
(3,4,2,6) , (4,3,2,6) , (3,4,6,2) , (4,3,6,2)
|
||
</pre>
|
||
|
||
<p><strong>示例 2:</strong></p>
|
||
|
||
<pre>
|
||
<strong>输入:</strong>nums = [1,2,4,5,10]
|
||
<strong>输出:</strong>16
|
||
<strong>解释:</strong>存在 16 个满足题意的元组:
|
||
(1,10,2,5) , (1,10,5,2) , (10,1,2,5) , (10,1,5,2)
|
||
(2,5,1,10) , (2,5,10,1) , (5,2,1,10) , (5,2,10,1)
|
||
(2,10,4,5) , (2,10,5,4) , (10,2,4,5) , (10,2,5,4)
|
||
(4,5,2,10) , (4,5,10,2) , (5,4,2,10) , (5,4,10,2)
|
||
</pre>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>提示:</strong></p>
|
||
|
||
<ul>
|
||
<li><code>1 <= nums.length <= 1000</code></li>
|
||
<li><code>1 <= nums[i] <= 10<sup>4</sup></code></li>
|
||
<li><code>nums</code> 中的所有元素 <strong>互不相同</strong></li>
|
||
</ul>
|