#P203. Problem D. Stack Out
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