QOJ.ac

QOJ

実行時間制限: 2.0 s メモリ制限: 256 MB 満点: 100 ハック可能 ✓

#8147. 数学考试

統計

世界上有许多整数序列,你的任务是找出有多少个序列是“好的”。 一个长度为 $n$ 的整数序列 $a_i$ 是好的,当且仅当以下所有条件成立:

  • $\forall i \in [1, n], 4S_i = a_i^2 + 2a_i + 1$
  • $\forall i \in [1, n], |a_i| \le m$

其中 $S_i = \sum_{j=1}^i a_j$。 给定 $n$ 和 $m$,保证 $m$ 是奇数。 由于答案可能非常大,请输出其对 $998\,244\,353$ 取模的结果。

输入格式

仅一行,包含两个整数 $n$ 和 $m$ ($1 \le n \le 10^7, 1 \le m \le 2n, m$ 为奇数)。

输出格式

输出一个整数——满足条件的“好的”序列的数量,对 $998\,244\,353$ 取模。

样例

样例输入 1

9 13

样例输出 1

124

样例输入 2

500 999

样例输出 2

195157058

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.