#P5900. 无标号无根树计数

    ID: 4351 远端评测题 3000ms 256MiB 尝试: 0 已通过: 0 难度: 9 上传者: 标签>数学O2优化Polya原理组合数学生成函数快速傅里叶变换 FFT

无标号无根树计数

Description

Find the number of unlabeled unrooted trees with nn nodes. Output the answer modulo 998244353998244353.

Input Format

Input one line with a positive integer nn.

Output Format

Output one line with one integer, representing the answer.

7
11
27
751065460

Hint

Constraints
For 30%30\% of the testdata, 1n10001\le n \le 1000;
For 100%100\% of the testdata, 1n2×1051\le n \le 2\times 10^5.

Although Θ(nlog2n)\Theta(n \log^2 n) can also pass, it is not very meaningful. It is recommended to implement a Θ(nlogn)\Theta(n \log n) solution.

Translated by ChatGPT 5