//項の数がO(NlogN)なのですが、分割FFTは...O(N^2)のメモリを使用するのでダメですねorz #include #include #include #define int long long #define rep(i, n) for(i = 0; i < n; i++) using namespace std; using namespace atcoder; using mint = modint998244353; //Π f_i(x) mod x^(n + 1) を求める, i in [l, r), r - l >= 1, f_i(x) mod x^(n + 1) = f_i(x) とする。 vector multiply(vector> &f, int l, int r, int n) { if (r - l == 1) { return f[l]; } vector res1 = multiply(f, l, (l + r) / 2, n); vector res2 = multiply(f, (l + r) / 2, r, n); vector ret = convolution(res1, res2); if (ret.size() > n + 1) ret.resize(n + 1); return ret; } signed main() { int n, K; cin >> n >> K; vector> fs; for (int i = 1; i <= n; i++) { vector f(n + 1); for (int j = 0; i * j <= n && j <= K; j++) { f[i * j] = 1; } fs.push_back(f); } vector res = multiply(fs, 0, n, n + 1); for (int i = 1; i <= n; i++) { cout << res[i].val(); if (i + 1 <= n) cout << " "; } cout << endl; return 0; }