码迷,mamicode.com
首页 > 其他好文 > 详细

[LeetCode] 920. Number of Music Playlists 音乐播放列表的个数

时间:2019-10-26 00:56:31      阅读:116      评论:0      收藏:0      [点我收藏+]

标签:inpu   problem   github   ring   blog   NPU   持续更新   tput   put   



Your music player contains?N?different songs and she wants to listen to?L?(not necessarily different) songs during your trip. ?You?create?a playlist so?that:

  • Every song is played at least once
  • A song can only be played again only if?K?other songs have been played

Return the number of possible playlists.??As the answer can be very large, return it modulo?10^9 + 7.

Example 1:

Input: N = 3, L = 3, K = 1
Output: 6
Explanation: There are 6 possible playlists. [1, 2, 3], [1, 3, 2], [2, 1, 3], [2, 3, 1], [3, 1, 2], [3, 2, 1].

Example 2:

Input: N = 2, L = 3, K = 0
Output: 6 Explanation: There are 6 possible playlists. [1, 1, 2], [1, 2, 1], [2, 1, 1], [2, 2, 1], [2, 1, 2], [1, 2, 2]

Example 3:

Input: N = 2, L = 3, K = 1
Output: 2
Explanation: There are 2 possible playlists. [1, 2, 1], [2, 1, 2]

Note:

  1. 0 <= K < N <= L <= 100



Github 同步地址:

https://github.com/grandyang/leetcode/issues/920



参考资料:

https://leetcode.com/problems/number-of-music-playlists/



LeetCode All in One 题目讲解汇总(持续更新中...)

[LeetCode] 920. Number of Music Playlists 音乐播放列表的个数

标签:inpu   problem   github   ring   blog   NPU   持续更新   tput   put   

原文地址:https://www.cnblogs.com/grandyang/p/11741490.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!