Simple Math
Practice
3.2 (5 votes)
Mathematics
Open
Approved
Easy
Problem
82% Success 10040 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code
Find the number of ways of distributing N objects into R groups such that each group gets 1 or more objects.
Input:
The one and only line of input contains two numbers separated by a single space, which are N and R respectively.
Output:
The corresponding answer modulo 10000007 in a single line and if no answer exist then print "-1".
Constraints:
1 <= N <= 100
1 <= R <= 100
Explanation
Let the 2 groups be A and B respectively. Case 1: A gets 1 object and B gets 3 Case 2: A gets 2 objects and B gets 2 Case 3: A gets 3 objects and B gets 1
Code Editor
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
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
1 votes
Tags:
CombinatoricsEasyMath
Editorial
Login to unlock the editorial
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
Results
Custom Input
Run your code to see the output