#P3904. 三只小猪

    ID: 2841 远端评测题 1000ms 125MiB 尝试: 0 已通过: 0 难度: 6 上传者: 标签>高精度递推组合数学排列组合线性递推,递推式

三只小猪

Description

For their safety, the little pigs built another new brick house. But now a problem arises: how should the three little pigs be assigned to the two houses? The third little pig is the smartest of the three. To avoid wasting any house, it considered a total of three plans, as shown below.

"But what about the future?" The third little pig knows that as their group grows, they will build more houses. It wants to know, given the numbers of houses and pigs, how many allocation plans there are. However, this problem is clearly a bit hard for it. Can you help the little pig solve it?

Input Format

The input contains a single line with two integers nn and mm, denoting the number of pigs and the number of houses (1n,m501 \leq n, m \leq 50).

Output Format

Output a single integer: the number of ways to place nn pigs into mm houses such that no house is left empty.

4 2
7
6 7
0

Hint

Translated by ChatGPT 5