# Number of ways of putting n balls in k boxes if boxes only fit n/2 balls

How can i find the unique ways of putting N balls in K boxes,considering that one box only fits N/2 balls.Boxes can have 0 balls.
Test case
N=4 K=3

Possible combinations

2 2 0
2 0 2
0 2 2
2 1 1
1 1 2
1 2 1

• Hint: can you do the problem without the cap? If so, then to conclude it helps to note that no unconstrained solution can violate the rule in more than one box...so now just study the solutions which do violate in exactly one box.
– lulu
Jun 21, 2017 at 19:04
• Note: your header doesn't match the body of the question (in one you say $\frac k2$ in the other you say $\frac N2$). Which did you intend? (my prior comment assumed you meant $\frac N2$). Also, you need to specify if the balls and or boxes are distinguishable. I would guess that you mean that the balls are indistinguishable but the boxes can be distinguished (but that is just a guess).
– lulu
Jun 21, 2017 at 19:07
• Yes i meant n/2 balls sorry @lulu Jun 21, 2017 at 19:22
• That's fine, but you still need to clarify whether the boxes are distinguishable or not. To be clear, if $N=4$ and $k=5$ are the two solutions $(2,2,0,0,0)$ and $(0,0,0,2,2)$ the same or are they different? (I am assuming you want the balls to be indistinguishable but if I am wrong about that you should say).
– lulu
Jun 21, 2017 at 19:23
• @lulu nope they are different. Jun 21, 2017 at 19:24