6

Divide n people into ceil(n/k) group(s), each group has at most k people

 9 months ago
source link: https://codeforces.com/blog/entry/123284
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

By _BAD_, 6 hours ago,

Can you please share your thoughts on the following question:

Problem: Count the number of ways (modulo mod) to divide n people into ceil(n/k) group(s), such that each group has no more than k people.

Constraints: In each file, only one of the following constraints will be applied:

  • n <= 10^5; mod <= 10^18
  • n <= 10^9; mod = 10^9 + 7

Example: n = 10, k = 4, mod = 1000000007 -> Answer: 6

Ways:

  • 2 | 4 | 4

  • 4 | 2 | 4

  • 4 | 4 | 2

  • 3 | 3 | 4

  • 3 | 4 | 3

  • 4 | 3 | 3

Thanks in advance.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK