Count leaderboards
Practice
3.3 (9 votes)
Dynamic programming
Combinatorics
Medium
Mathematics
Open
Approved
Problem
94% Success 173 Attempts 30 Points 1s Time Limit 256MB Memory 1024 KB Max Code

You are about to organize a big programming competition. N competitors are registered for it. You know that you are going to divide all of them in some number of rooms. After the competition, each room will have its own leaderboard computed i.e. the order of competitors in that room based on their performance. You decided that after the competition, K random competitors will be awarded by lucky-one award. You will mark these lucky competitors with stars near their names on leaderboards. You set the scoring in such a way that there will be no draws between any players.

A global leaderboard is a set of leaderboards of all rooms after the competition, with exactly K lucky competitors marked with stars near their names.

You are interested in how many different global leaderboards exist.

Since the resulting number of global leaderboards can be very large, you are interested its value modulo 109 + 7

Input:

In the one and only line of input, there are two integers N and K, denoting the number of competitors registered for the contest and the number of competitors to be awarded by lucky-one award.

Output:

In one line, output the number of different global leaderboards.

Constraints:

1 ≤ N ≤ 1000
0 ≤ KN

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:30
Tags:
Medium
Points:20
222 votes
Tags:
AlgorithmsApprovedBinary SearchEasyMathOpenSorting
Points:30
2 votes
Tags:
DP