#P1287. 盒子与球
盒子与球
Description
There are distinct boxes and distinct balls. Put these balls into the boxes, with no box left empty. Find how many different placements there are.
Two placements are different if and only if there exists a ball that is placed into different boxes in the two placements.
Input Format
The input contains one line with two integers, representing and .
Output Format
Output one line with a single integer representing the answer.
3 2
6
Hint
Sample Explanation 1
There are two boxes (IDs ) and three balls (IDs ), for a total of six arrangements, as follows:
| Box ID | Arrangement 1 | Arrangement 2 | Arrangement 3 | Arrangement 4 | Arrangement 5 | Arrangement 6 |
|---|---|---|---|---|---|---|
| Box | Ball | Ball | Ball | Balls | Balls | Balls |
| Box | Balls | Balls | Balls | Ball | Ball | Ball |
Constraints
For of the testdata, it is guaranteed that , and the answer is less than .
Translated by ChatGPT 5
京公网安备 11011102002149号