1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-11 18:31:41 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee

存量题库数据更新

This commit is contained in:
2023-12-09 18:42:21 +08:00
parent a788808cd7
commit c198538f10
10843 changed files with 288489 additions and 248355 deletions

View File

@@ -1,39 +1,41 @@
<p>你的音乐播放器里有&nbsp;<code>N</code>&nbsp;首不同的歌,在旅途中,你的旅伴想要<code>L</code>&nbsp;首歌(不一定不同,即,允许歌曲重复)。请你为她按如下规则创建一个播放列表:</p>
<p>你的音乐播放器里有 <code>n</code> 首不同的歌,在旅途中,你计划<code>goal</code> 首歌(不一定不同,即,允许歌曲重复)。你将会按如下规则创建播放列表:</p>
<ul>
<li>每首歌至少播放一次</li>
<li>一首歌只有在其他 <code>K</code> 首歌播放完之后才能再次播放。</li>
<li>每首歌 <strong>至少播放一次</strong> </li>
<li>一首歌只有在其他 <code>k</code> 首歌播放完之后才能再次播放。</li>
</ul>
<p>返回可以满足要求的播放列表的数量。<strong>由于答案可能非常大,请返回它模&nbsp;<code>10^9 + 7</code>&nbsp;的结果。</strong></p>
<p>&nbsp;</p>
<p>给你 <code>n</code><code>goal</code><code>k</code> 返回可以满足要求的播放列表的数量。由于答案可能非常大,请返回<code>10<sup>9</sup> + 7</code> <strong>取余</strong> 的结果。</p>
&nbsp;
<p><strong>示例 1</strong></p>
<pre><strong>输入:</strong>N = 3, L = 3, K = 1
<pre>
<strong>输入:</strong>n = 3, goal = 3, k = 1
<strong>输出:</strong>6
<strong>解释:</strong>有 6 种可能的播放列表。[1, 2, 3][1, 3, 2][2, 1, 3][2, 3, 1][3, 1, 2][3, 2, 1].
<strong>解释:</strong>有 6 种可能的播放列表。[1, 2, 3][1, 3, 2][2, 1, 3][2, 3, 1][3, 1, 2][3, 2, 1]
</pre>
<p><strong>示例 2</strong></p>
<pre><strong>输入:</strong>N = 2, L = 3, K = 0
<pre>
<strong>输入:</strong>n = 2, goal = 3, k = 0
<strong>输出:</strong>6
<strong>解释:</strong>有 6 种可能的播放列表。[1, 1, 2][1, 2, 1][2, 1, 1][2, 2, 1][2, 1, 2][1, 2, 2]
<strong>解释:</strong>有 6 种可能的播放列表。[1, 1, 2][1, 2, 1][2, 1, 1][2, 2, 1][2, 1, 2][1, 2, 2]
</pre>
<p><strong>示例 3</strong></p>
<pre><strong>输入:</strong>N = 2, L = 3, K = 1
<pre>
<strong>输入:</strong>n = 2, goal = 3, k = 1
<strong>输出:</strong>2
<strong>解释:</strong>有 2 种可能的播放列表。[1, 2, 1][2, 1, 2]
<strong>解释:</strong>有 2 种可能的播放列表。[1, 2, 1][2, 1, 2]
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ol>
<li><code>0 &lt;= K &lt; N &lt;= L &lt;= 100</code></li>
</ol>
<ul>
<li><code>0 &lt;= k &lt; n &lt;= goal &lt;= 100</code></li>
</ul>