(defconstant +mod+ 998244353) (defun main (&rest argv) (declare (ignorable argv)) (let* ((n (read)) (k (read)) (dp1 (make-array (1+ n) :initial-element 0)) (dp2 (make-array (1+ n) :initial-element 0))) (setf (aref dp1 0) 1) (setf (aref dp2 0) 1) (loop for i from 1 to n if (minusp (- i k)) do (setf (aref dp1 i) 0) else do (incf (aref dp1 i) (aref dp2 (- i k))) (setf (aref dp1 i) (mod (aref dp1 i) +mod+)) do (incf (aref dp2 i) (+ (aref dp2 (1- i)) (aref dp1 i))) (setf (aref dp2 i) (mod (aref dp2 i) +mod+))) (format t "~d~%" (aref dp2 n)))) (main)