You are given n candies, all of which are identical in every
aspect. You have to distribute these candies
completely among m children. Out of these m children, there
are p number of children each of whom wants an odd
number of candies, whereas each of the other (m – p
children) wants an even (including 0) number of candies
Two distributions are considered different if at least one of
the children gets a different number of candies.
Determine the number of ways of such distribution.
Example
Consider n = 3 m = 2 p = 1
. There are 2 children out of which one wants odd and
the other wants even candies respectively
. The distributions are as follows (1, 2) and (3, 0). Thus
the answer is 2
I am finding it really difficult to understand this problem and solve it using dynamic programming. Could someone please explain the subproblems, recurrence relation can be arrived for in detail for this question.