QOJ.ac

QOJ

Límite de tiempo: 4 s Límite de memoria: 256 MB Puntuación total: 100

#959. 倍数?

Estadísticas

给定一个整数 $n$,如果一个序列的元素均来自 $[1, n]$,且其所有非空子序列(不一定连续)的和均不能被 $n$ 整除,则称该序列为“好”序列。

计算长度为 $n - k$ 的好序列的数量,结果对 $998\,244\,353$ 取模。

输入格式

输入仅一行,包含两个整数 $n$ 和 $k$ ($1 \le k \le n/4 < n < 998\,244\,353$)。

输出格式

输出一个整数,即问题的答案。

样例

样例输入 1

4 1

样例输出 1

2

样例输入 2

9 2

样例输出 2

48

样例输入 3

222222222 222222

样例输出 3

851798824

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
#319EditorialOpen题解jiangly2025-12-14 07:04:22View

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.