Now a permutation $$$p=[1,2,3,\dots,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 $$$\mathtt{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$$$.
Only one line, contains two integers $$$n$$$ $$$(1\le n\le 3000)$$$ and $$$k$$$ $$$(1\le k\le n)$$$, separated by a space.
One line, print the answer modulo $$$998244353$$$.
3 2
4
The $$$k$$$-good $$$Q$$$ are $$$[\mathtt{1,-1,2,3,-3,-2}]$$$, $$$[\mathtt{1,2,-2,-1,3,-3}]$$$, $$$[\mathtt{1,2,3,-3,-2,-1}]$$$, $$$[\mathtt{1,2,-2,3,-3,-1}]$$$.
Name |
---|