mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-11 02:58:13 +08:00
35 lines
1.3 KiB
HTML
35 lines
1.3 KiB
HTML
|
<p>给你一个整数数组 <code>nums</code> 和一个整数 <code>k</code> ,请你统计并返回 <code>nums</code> 的 <strong>子数组</strong> 中满足 <em>元素最小公倍数为 <code>k</code> </em>的子数组数目。</p>
|
|||
|
|
|||
|
<p><strong>子数组</strong> 是数组中一个连续非空的元素序列。</p>
|
|||
|
|
|||
|
<p><strong>数组的最小公倍数</strong> 是可被所有数组元素整除的最小正整数。</p>
|
|||
|
|
|||
|
<p> </p>
|
|||
|
|
|||
|
<p><strong>示例 1 :</strong></p>
|
|||
|
|
|||
|
<pre><strong>输入:</strong>nums = [3,6,2,7,1], k = 6
|
|||
|
<strong>输出:</strong>4
|
|||
|
<strong>解释:</strong>以 6 为最小公倍数的子数组是:
|
|||
|
- [<em><strong>3</strong></em>,<em><strong>6</strong></em>,2,7,1]
|
|||
|
- [<em><strong>3</strong></em>,<em><strong>6</strong></em>,<em><strong>2</strong></em>,7,1]
|
|||
|
- [3,<em><strong>6</strong></em>,2,7,1]
|
|||
|
- [3,<em><strong>6</strong></em>,<em><strong>2</strong></em>,7,1]
|
|||
|
</pre>
|
|||
|
|
|||
|
<p><strong>示例 2 :</strong></p>
|
|||
|
|
|||
|
<pre><strong>输入:</strong>nums = [3], k = 2
|
|||
|
<strong>输出:</strong>0
|
|||
|
<strong>解释:</strong>不存在以 2 为最小公倍数的子数组。
|
|||
|
</pre>
|
|||
|
|
|||
|
<p> </p>
|
|||
|
|
|||
|
<p><strong>提示:</strong></p>
|
|||
|
|
|||
|
<ul>
|
|||
|
<li><code>1 <= nums.length <= 1000</code></li>
|
|||
|
<li><code>1 <= nums[i], k <= 1000</code></li>
|
|||
|
</ul>
|