luogu#P5205. 【模板】多项式开根
【模板】多项式开根
Background
This is a template problem, with no background.
Problem Description
Given a polynomial of degree , find a polynomial modulo such that . If there are multiple solutions, output the one with the smaller constant-term coefficient.
All polynomial coefficients are computed modulo .
Input Format
The first line contains a positive integer .
The next line contains integers, representing the coefficients of the polynomial in order.
It is guaranteed that .
Output Format
Output integers, representing the coefficients of the answer polynomial.
3
1 2 1
1 1 0
7
1 8596489 489489 4894 1564 489 35789489
1 503420421 924499237 13354513 217017417 707895465 411020414
Hint
For of the testdata: , .
Translated by ChatGPT 5