P5432 A/B Problem (High-Precision Division II)

Description

You are given two positive integers $a, b$. Find $\lfloor a/b \rfloor$. To rule out some brute-force solutions, you must process the answer as follows. Let the answer be $r$, and construct a polynomial $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 $r$, each digit is used as the coefficient of one term of $F(x)$. Let the highest non-zero degree of $F(x)$ be $n$. You need to find a degree-$n$ polynomial $G(x)$ such that: $$ F(x) \cdot G(x) \equiv 1 \pmod{x^{n+1}}$$ Take the coefficients of $G(x)$ modulo $998244353$, then output the coefficients of $G(x)$ in increasing order of degree. It is guaranteed that such a $G(x)$ exists.

Input Format

Two lines, each containing one positive integer, which are $a$ and $b$, respectively.

Output Format

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

Explanation/Hint

**Sample Explanation** $\left\lfloor \dfrac{19260817}{114514} \right\rfloor = 168$. The polynomial constructed is $F(x) = x^2 + 6x + 8$. The corresponding $G(x)$ is $943652865x^2 + 93585408x + 873463809$. **Constraints** For $100\%$ of the testdata, $1 \le b \le a \le 10^{200000}$. Translated by ChatGPT 5