Alex Larson has an amount $X. She wants to distribute the amount among her N friends. Find the number of ways in which she can distribute this amount such that each friend gets at least $1. As the number of ways can be large so print it modulo 10 +7. You have to complete the function count_ways that receives two integers X and N as arguments and returns the total number of ways. Constraints 1 ≤ X ≤ 10 1 ≤ N ≤ 50 Note The order of distribution does not matter. If X=3 and N=2 then ﴾1, 2﴿ and ﴾2, 1﴿ are considered same. Sample Input 0
Sample Output 0
Explanation X=6, N=3 There are 3 ways of distributing Rs 6 among 3 daughters, (1,1,4) ,(1,2,3) and (2,2,2).
Sample Input 1
Sample Output 1
I know it can be solved by (n+r-1)C(r-1) but i tried not able to get the desired output..
If anyone solved it please post the answer..