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 NN nodes, labeled from 11 to NN, 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 MM.

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 998244353998244353.

Input Format

A single line with two integers N,MN, M.

Output Format

A single line with one integer, representing the answer.

3 2
3
7 4
2520

Hint

Percentage of testdata Constraints
10%10\% N,M8N, M \le 8
30%30\% N,M100N, M \le 100
50%50\% N,M500N, M \le 500
70%70\% N,M2000N, M \le 2000
100%100\% 2N,M5×1042 \le N, M \le 5 \times 10^4

Translated by ChatGPT 5