QOJ.ac

QOJ

時間限制: 1.0 s 記憶體限制: 512 MB 總分: 100 可 Hack ✓

#15549. 布丁商店

统计

159 是一个男孩子。他有一家布丁店。

布丁店里有 $n$ 个不同的布丁,编号为 $1$ 到 $n$,它们排成一排。(注意,排在第 $i$ 个位置的布丁的编号不一定是 $i$。)现在,有 $n$ 个编号为 $1$ 到 $n$ 的学生将以一种特定的方式来品尝这些布丁。具体来说,对于第 $i$ 个学生,他会品尝排在队伍前 $i$ 个位置的每一个布丁。品尝编号为 $i$ 的布丁会给品尝者带来 $2 \times i$ 的满意度。如果第 $i$ 个学生获得的所有满意度之和能被 $i$ 整除,我们就说第 $i$ 个学生是满意的。

现在,159 想知道,有多少种不同的布丁排列方式,使得每个学生在品尝后都能感到满意。如果存在一个布丁在两种排列中的位置不同,则认为这两种排列是不同的。注意,排列的数量可能非常大,因此他只需要输出结果模 $998244353$ 的余数。

输入格式

每个测试点包含多个测试用例。第一行包含测试用例的数量 $t$ ($1 \le t \le 10$)。接下来是测试用例的描述。

每个测试用例的第一行也是唯一的一行包含一个整数 $n$ ($1 \le n \le 10^9$) —— 布丁和学生的数量。

输出格式

对于每个测试用例,输出一行,包含一个整数 —— 满足条件的排列数量模 $998244353$ 的值。

样例

输入样例 1

3
1
2
3

输出样例 1

1
2
6

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.