in general, this type of questions are equivalent to calculating states of assembly N particles into K energy states. N could be distinguishable or non-distinguishable. K could be with/without degeneracy.
For Type 1 and 2, when K are states without degeneracy, discrete solution exist as spelled out in the original post. For type 3 and 4 where degeneracy are allowed, Trivial was right that no analytic solution exist for the discrete states.For continuous states, or the K and N are significantly large, analytic solution exists with Stirling approximation for Type 4 question: N indistinguishable particle in K-fold degenerate states, this leads to Bose-Eistein distribution.
我不建议初/高中孩子学习第三和第四类太多,错误的公式可能会误导以后的学习。如果有兴趣深入研究,统计物理是不错的切入点。