P29189 [洛谷] Counting Trees
省选
题目描述

Problem Description

Determine the number of distinct labeled unrooted trees with $n$ nodes, such that for any node $x$, there exists a node $y$ such that $x$ and $y$ are connected by an edge and $|x - y| = 1$. The answer should be modulo $998244353$.

Input Format

A single line containing a positive integer $n$.

Output Format

A single line containing an integer, the required answer.

Sample Input and Output

Sample Input #1

4

Sample Output #1

4

Sample Input #2

209

Sample Output #2

21754876

Sample Input #3

5

Sample Output #3

11

Sample Input #4

6

Sample Output #4

56

Notes

[Sample Explanation #1]

Untitled.png

The four trees that meet the criteria in Sample #1 are shown in the image above.


[Data Range]

This problem includes 20 test cases, each worth 5 points.

Test Case Number Range of $n$
$1 \sim 2$ $\leq 7$
$3 \sim 4$ $\leq 14$
$5 \sim 8$ $\leq 30$
$9 \sim 12$ $\leq 10^3$
$13 \sim 20$ $\leq 10^5$

For all test cases, $n$ is a positive integer and $2 \leq n \leq 10^5$.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
4
样例输出
4