luogu#P5050. 【模板】多项式多点求值
【模板】多项式多点求值
Problem Description
Given an -degree polynomial , for each , compute .
Input Format
The first line contains two positive integers , representing the degree of the polynomial and the number of points to evaluate.
The second line contains non-negative integers, giving the coefficients of the polynomial from low degree to high degree.
The third line contains non-negative integers, representing .
Output Format
Output a total of lines, each containing non-negative integer.
The number on line represents .
The answer should be taken modulo .
10 10
18 2 6 17 7 19 17 6 2 12 14
4 15 5 20 2 6 20 12 16 5
18147258
804760733
161737928
73381527
23750
973451550
73381527
525589927
842520242
161737928
Hint
Constraints: , .
represents the coefficient of the -th term of .
Translated by ChatGPT 5