QOJ.ac

QOJ

Limite de temps : 1 s Limite de mémoire : 1024 MB Points totaux : 100

#6736. 爱丽丝与鲍勃

Statistiques

Alice 和 Bob 正在玩一个游戏。 他们给定一个排列 $p$,并轮流执行以下操作,Alice 先手:

  • 操作:将 $p_1 \dots p_n$ 重新排列成任意顺序。

如果某人执行了两次相同的 $p_1$,则该人输掉比赛。 Alice 和 Bob 都非常聪明,总是会选择最优操作来确保获胜。 给定所有大小为 $n$ 的排列,确定其中有多少个排列 Bob 会获胜,结果对 $998244353$ 取模。

输入格式

输入的第一行包含一个整数 $n$ ($1 \le n \le 10^7$)。

输出格式

输出一行,包含一个整数,表示答案。

样例

样例输入 1

1

样例输出 1

1

样例输入 2

2

样例输出 2

1

样例输入 3

10

样例输出 3

997920

样例输入 4

100

样例输出 4

188898954

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
#154EditorialOpen题解jiangly2025-12-12 23:37:31View

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.