Problem G. Problem G. Cyclic

时间限制 1000 ms   内存限制 512 MB

Count the number of cyclic permutations of length n with no continuous subsequence [i, i + 1 mod n].
Output the answer modulo 998244353.
 

输入数据

The first line of the input contains an integer T , denoting the number of test cases.
In each test case, there is a single integer n in one line, denoting the length of cyclic permutations.
1 ≤ T ≤ 20, 1 ≤ n ≤ 100000
 

输出数据

For each test case, output one line contains a single integer, denoting the answer modulo 998244353.
 

样例输入

复制
3
4
5
6

样例输出

复制
1
8
36

提交

请先 登录

© 2025 FAQs Contact About