luogu#P5219. 无聊的水题 I
无聊的水题 I
Background
The problem setter is too weak and can only make this kind of problem. It is slightly time-limit tight.
Problem Description
DLS likes climbing trees.
However, he does not want to put a data structure problem onto a tree; he likes counting Tree.
One day, he wants to build a tree by himself. He has nodes, labeled from to , and he will connect edges between them. We define two trees to be different if and only if there exists a pair of nodes such that they are connected by an edge in one tree, but not connected by an edge in the other tree.
But he does not like a tree with too many branches, so he wants the maximum degree among all nodes in this tree to be .
Since DLS is not very good at math and science, he hopes you can help him compute how many such trees there are.
Output the answer modulo .
Input Format
A single line with two integers .
Output Format
A single line with one integer, representing the answer.
3 2
3
7 4
2520
Hint
| Percentage of testdata | Constraints |
|---|---|
Translated by ChatGPT 5