CF1716D.Chip Move

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

There is a chip on the coordinate line. Initially, the chip is located at the point 00 . You can perform any number of moves; each move increases the coordinate of the chip by some positive integer (which is called the length of the move). The length of the first move you make should be divisible by kk , the length of the second move — by k+1k+1 , the third — by k+2k+2 , and so on.

For example, if k=2k=2 , then the sequence of moves may look like this: 04719440 \rightarrow 4 \rightarrow 7 \rightarrow 19 \rightarrow 44 , because 40=44 - 0 = 4 is divisible by 2=k2 = k , 74=37 - 4 = 3 is divisible by 3=k+13 = k + 1 , 197=1219 - 7 = 12 is divisible by 4=k+24 = k + 2 , 4419=2544 - 19 = 25 is divisible by 5=k+35 = k + 3 .

You are given two positive integers nn and kk . Your task is to count the number of ways to reach the point xx , starting from 00 , for every x[1,n]x \in [1, n] . The number of ways can be very large, so print it modulo 998244353998244353 . Two ways are considered different if they differ as sets of visited positions.

输入格式

The first (and only) line of the input contains two integers nn and kk ( 1kn21051 \le k \le n \le 2 \cdot 10^5 ).

输出格式

Print nn integers — the number of ways to reach the point xx , starting from 00 , for every x[1,n]x \in [1, n] , taken modulo 998244353998244353 .

输入输出样例

  • 输入#1

    8 1

    输出#1

    1 1 2 2 3 4 5 6
  • 输入#2

    10 2

    输出#2

    0 1 0 1 1 1 1 2 2 2

说明/提示

Let's look at the first example:

Ways to reach the point 11 : [0,1][0, 1] ;

Ways to reach the point 22 : [0,2][0, 2] ;

Ways to reach the point 33 : [0,1,3][0, 1, 3] , [0,3][0, 3] ;

Ways to reach the point 44 : [0,2,4][0, 2, 4] , [0,4][0, 4] ;

Ways to reach the point 55 : [0,1,5][0, 1, 5] , [0,3,5][0, 3, 5] , [0,5][0, 5] ;

Ways to reach the point 66 : [0,1,3,6][0, 1, 3, 6] , [0,2,6][0, 2, 6] , [0,4,6][0, 4, 6] , [0,6][0, 6] ;

Ways to reach the point 77 : [0,2,4,7][0, 2, 4, 7] , [0,1,7][0, 1, 7] , [0,3,7][0, 3, 7] , [0,5,7][0, 5, 7] , [0,7][0, 7] ;

Ways to reach the point 88 : [0,3,5,8][0, 3, 5, 8] , [0,1,5,8][0, 1, 5, 8] , [0,2,8][0, 2, 8] , [0,4,8][0, 4, 8] , [0,6,8][0, 6, 8] , [0,8][0, 8] .

首页