#P5748. 集合划分计数

    ID: 4710 远端评测题 1000ms 125MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>数学Special JudgeO2优化组合数学生成函数快速傅里叶变换 FFT

集合划分计数

Description

Given a set with nn elements, split it into any number of non-empty subsets, and find the number of possible ways.

Note that the resulting subsets are unordered. That is, {{1,2},{3}}\{\{1,2\},\{3\}\} and {{3},{2,1}}\{\{3\},\{2,1\}\} are considered the same partition.

Since the answer may be very large, output it modulo 998244353998244353.

Input Format

The first line contains a positive integer TT, which indicates the number of test cases.
The next TT lines each contain a positive integer nn.

Output Format

Output TT lines, each containing one integer representing the answer.

5
2
3
7
9
233
2
5
877
21147
53753544

Hint

Constraints
T=1000T = 1000, 1n1051 \le n \le 10^5.

Sample Explanation
For n=3n=3, there are five ways: $\{\{1,2,3\}\},\{\{1,2\},\{3\}\},\{\{1\},\{2,3\}\},\{\{1\},\{2\},\{3\}\},\{\{1,3\},\{2\}\}$.

This problem has only one test point. Suppose you answer xx test cases correctly, you will get x/(T/100)\lfloor x/(T/100) \rfloor points.
If you cannot solve all the test cases, please still output TT integers.

Do not blame me for TLE. Your constant factor is too large.

Translated by ChatGPT 5