Problem D. Stack Out
该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。
Description
Now a permutation p = [1, 2, 3, . . . , n] will be pushed into a stack S in order, and a sequence Q is generated in the following way:
Assume that S and Q are empty initially, and iterator = 1.
Each time, Starlight Glimmer takes one legal operation of the following two: Starlight Glimmer wants to know the number of k-good sequence Q if she takes action arbitrarily.
A sequence Q called k-good if: In other words, there should be consecutive pops whose length exceeds k − 1.
Please tell her the answer modulo 998244353
Format
Input
Only one line, contains two integers n (1 ≤ n ≤ 3000) and k (1 ≤ k ≤ n), separated by a space
Output
One line, print the answer modulo 998244353
Samples
3 2
4
Note
The k-good Q are [1, −1, 2, 3, −3, −2], [1, 2, −2, −1, 3, −3], [1, 2, 3, −3, −2, −1], [1, 2, −2, 3, −3, −1].
Limitation
Input file:
standard input
Output file:
standard output
Time limit: 1 second
Memory limit: 512 megabytes
逐梦启航,编译未来——2023-2024学年“Coder启航杯”第2轮竞赛(英语)
- 状态
- 已结束
- 规则
- ACM/ICPC
- 题目
- 5
- 开始于
- 2024-4-13 9:00
- 结束于
- 2024-4-13 12:00
- 持续时间
- 3 小时
- 主持人
- 参赛人数
- 4