|
|||||||||||||||||||
|
SPOJ time: 2012-02-09 01:57:26 |
ApproximationProblem code: HS09APR
Given coordinates (Xi, Yi ) of N points of the plane, calculate the coefficients A, B, C, and D of the polynomial W(X)=A*X3 + B*X2 + C*X + D, such that value of the function InputThe first line of input consists of a single positive integer N (5<=N<=50), representing the number of points. Each of the following N lines contains the coordinates Xi, Yi (-1000<= Xi, Yi <=1000), given with two digits precision after the decimal dot. OutputOutput a single line containing the coefficients A, B, C, D of the sought polynomial, separated by spaces. Print all numbers with two digits precision after the decimal dot. ExampleInput:
9
-4.00 -74.00
-3.00 -26.00
-2.00 0.00
-1.00 10.00
0.00 10.00
1.00 6.00
2.00 4.00
3.00 10.00
4.00 30.00
Output:
1.00 -2.00 -3.00 10.00
ScoringFor solving this problem you will score 10 points.
|
||||||||||||||||||
| |||||||||||||||||||