#P2767. 树的数量

    ID: 1707 远端评测题 1000ms 128MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>动态规划,dp图论树形结构洛谷原创

树的数量

Description

Compute the number of rooted mm-ary trees (unlabeled) with nn nodes, modulo 1000710\,007.

Two rooted trees are identical if and only if their roots are identical and, from left to right, each subtree is also identical. In particular, if both rooted trees are empty, they are considered identical.

Input Format

Input two integers nn, mm.

Output Format

Output the number of rooted mm-ary trees (unlabeled) with nn nodes, modulo 1000710\,007.

2 2
2

Hint

Constraints: n,m127n, m \leq 127.

Translated by ChatGPT 5