#P3711. 仓鼠的数学题

    ID: 2679 远端评测题 1000ms 125MiB 尝试: 0 已通过: 0 难度: 9 上传者: 标签>洛谷原创O2优化生成函数逆元洛谷月赛

仓鼠的数学题

Description

A hamster saw a problem on some OJ. Let Sk(x)=i=0xikS_k(x)=\sum_{i=0}^x i^k. This problem inputs a0,a1ana_0, a_1 \ldots a_n. Suppose 00=10^0=1. You are asked to compute k=0nSk(x)ak\sum_{k=0}^{n} S_k(x) a_k.

The hamster thought for two seconds and solved it in a flash. He found the constraints were only 10001000, so he casually added two zeros.

But the hamster was too lazy to make testdata, so he threw this problem to you.

Input Format

The first line contains an integer nn.

The second line contains n+1n+1 space-separated non-negative integers: a0,,ana_0, \cdots, a_n.

Output Format

Output n+2n+2 space-separated integers, the coefficients c0,,cn+1c_0, \cdots, c_{n+1} of the answer polynomial, meaning the polynomial is i=0n+1cixi\sum_{i=0}^{n+1} c_i x^i. The coefficients are taken modulo 998244353998244353.

It can be proved that the degree of the polynomial is n+1\leq n+1.

2
3 3 3
3 5 3 1

Hint

For 10%10\% of the testdata, n500n \leq 500.

For 30%30\% of the testdata, n3000n \leq 3000.

For 70%70\% of the testdata, n100000n \leq 100000.

For 100%100\% of the testdata, 1n2500001 \leq n \leq 250000.

Both the input and output polynomial coefficients are taken modulo 998244353998244353 and are non-negative integers in [0,998244352][0, 998244352].

Translated by ChatGPT 5