#t479. 可重排列

可重排列

Permutations with Repetition

Problem Description

Place  n \,n\, distinct balls into  m \,m\, distinct boxes; boxes are allowed to be empty. How many ways are there to do this?

Input Format

One line: n,m (1≤n≤10,1≤m≤10)n,m \,(1\le n\le 10,1\le m\le 10), separated by a single space.

Output Format

One line: an integer, the correct answer.

Sample Input

7 4

Sample Output

16384

Hint

📚 Topic tag: this problem belongs to the combinatorial counting topic. It is not a loop problem and is placed here as optional material. If you have just started learning loops, feel free to skip it and come back when you have spare time.

Hint: think of each ball independently choosing a box; use the multiplication principle.