QOJ.ac

QOJ

时间限制: 4 s 内存限制: 256 MB 总分: 100

#959. 倍數?

统计

給定一個整數 $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.