luogu#P4781. 【模板】拉格朗日插值
【模板】拉格朗日插值
Background
This is a template problem.
Problem Description
For points , if , then these points uniquely determine a polynomial of degree .
Now, given such points, please determine this degree polynomial and compute the value of .
Input Format
The first line contains two integers .
The next lines each contain two integers on the -th line.
Output Format
Output one integer in one line, representing the value of .
3 100
1 4
2 9
3 16
10201
3 100
1 1
2 2
3 3
100
Hint
In Sample 1, the polynomial is , and .
In Sample 2, the polynomial is , and .
Constraints: , , and all are pairwise distinct.
Translated by ChatGPT 5