marbles spoj , how can the problem be solved ??

please help solving this combinatorics problem

1 Like

problem link
for those who dont know

this is a easy problem based on permutations and combinations

the number of ways of selecting n marbles , such that each marbles of atleast 1 type is selected considering k types is same as
(number of ways of getting sum n of k numbers and each number is greater than equal to 1 )

it is same as finding the coefficient of x^n in binomial expansion of

this comes out to be C(n-1,k-1)