1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-10 18:48:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/优质数对的总数 II [find-the-number-of-good-pairs-ii].html
2024-06-05 08:50:06 +08:00

42 lines
1.5 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p>给你两个整数数组 <code>nums1</code><code>nums2</code>,长度分别为 <code>n</code><code>m</code>。同时给你一个<strong>正整数</strong> <code>k</code></p>
<p>如果 <code>nums1[i]</code> 可以被 <code>nums2[j] * k</code> 整除,则称数对 <code>(i, j)</code><strong>优质数对</strong><code>0 &lt;= i &lt;= n - 1</code>, <code>0 &lt;= j &lt;= m - 1</code>)。</p>
<p>返回<strong> 优质数对 </strong>的总数。</p>
<p>&nbsp;</p>
<p><strong class="example">示例 1</strong></p>
<div class="example-block">
<p><strong>输入:</strong><span class="example-io">nums1 = [1,3,4], nums2 = [1,3,4], k = 1</span></p>
<p><strong>输出:</strong><span class="example-io">5</span></p>
<p><strong>解释:</strong></p>
<p>5个优质数对分别是 <code>(0, 0)</code>, <code>(1, 0)</code>, <code>(1, 1)</code>, <code>(2, 0)</code>, 和 <code>(2, 2)</code></p>
</div>
<p><strong class="example">示例 2</strong></p>
<div class="example-block">
<p><strong>输入:</strong><span class="example-io">nums1 = [1,2,4,12], nums2 = [2,4], k = 3</span></p>
<p><strong>输出:</strong><span class="example-io">2</span></p>
<p><strong>解释:</strong></p>
<p>2个优质数对分别是 <code>(3, 0)</code><code>(3, 1)</code></p>
</div>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= n, m &lt;= 10<sup>5</sup></code></li>
<li><code>1 &lt;= nums1[i], nums2[j] &lt;= 10<sup>6</sup></code></li>
<li><code>1 &lt;= k &lt;= 10<sup>3</sup></code></li>
</ul>