#P5432. A/B Problem(高精度除法Ⅱ)

    ID: 6161 远端评测题 2000ms 500MiB 尝试: 0 已通过: 0 难度: 9 上传者: 标签>数学倍增O2优化快速傅里叶变换 FFT快速数论变换 NTT

A/B Problem(高精度除法Ⅱ)

Problem Description

You are given two positive integers a,ba, b. Find a/b\lfloor a/b \rfloor.

To rule out some brute-force solutions, you must process the answer as follows.

Let the answer be rr, and construct a polynomial F(x)F(x):

$$F(x) = \sum\limits_{i=0}^{\lfloor \lg r \rfloor} (\lfloor 10^{-i}r \rfloor \bmod 10) \cdot x^i$$

Simply put, from the lowest digit to the highest digit of rr, each digit is used as the coefficient of one term of F(x)F(x).

Let the highest non-zero degree of F(x)F(x) be nn. You need to find a degree-nn polynomial G(x)G(x) such that:

F(x)G(x)1(modxn+1)F(x) \cdot G(x) \equiv 1 \pmod{x^{n+1}}

Take the coefficients of G(x)G(x) modulo 998244353998244353, then output the coefficients of G(x)G(x) in increasing order of degree.

It is guaranteed that such a G(x)G(x) exists.

Input Format

Two lines, each containing one positive integer, which are aa and bb, respectively.

Output Format

Output one line with n+1n+1 integers, the coefficients of G(x)G(x).

19260817
114514
873463809 93585408 943652865 

Hint

Sample Explanation

$\left\lfloor \dfrac{19260817}{114514} \right\rfloor = 168$.

The polynomial constructed is F(x)=x2+6x+8F(x) = x^2 + 6x + 8.

The corresponding G(x)G(x) is 943652865x2+93585408x+873463809943652865x^2 + 93585408x + 873463809.

Constraints

For 100%100\% of the testdata, 1ba102000001 \le b \le a \le 10^{200000}.

Translated by ChatGPT 5