有N个相同的小球,要求放到k个相同的盒子中,盒子可以为空,但一定要把所有球都放进盒子中,问共有多少种放法。
所有符合条件的情况的种数为c[N+k-1][k-1]。
由组合数的公式可得c[m][n]=c[m-1][n-1]+c[m-1][n]
利用加法公式C(n+1,k+1)=C(n,k)+C(n,k+1)