Hi,

I have the following problem, which at first I thought should be really simple, but so far I can't seem to find any solution to this:

Say I have a number of equal items that are to be distributed between a number of bins, like N pieces of cake that are to be distributed between M children. The number of possible distributions for this is (N over (M-1)).

However, let's say I want to limit the number of items per bin to, say, 2? So I want to distribute the N pieces of cake between the M children, without any child getting more than 2 pieces of cake (assuming there are at least N/2 children). Does anyone have any suggestions how I can count the number of possibilities in this case?

Henrik