#t478. 放球入盒

放球入盒

Balls into Boxes

Problem Description

Teacher Yang places nn identical balls into mm distinct boxes; a box may be empty. How many different ways are there to distribute the balls?

Input Format

One line, two integers n,mn, m (1≤n,m≤101 \le n, m \le 10).

Output Format

One line, one integer: the correct answer to the problem.

Sample Input

7 4

Sample Output

120

Hint

  • Topic tag: this problem belongs to the combinatorial counting topic, not a loop exercise — treat it as optional enrichment. Beginners practising loops can safely skip it and come back later.
  • Hint: the balls are completely identical — try the "stars and bars" method. The answer is (n+m−1m−1)\binom{n+m-1}{m-1} (here (103)=120\binom{10}{3} = 120).