问题2917--Equation's solution

2917: Equation's solution

[命题人 : ]
时间限制 : 1.000 sec  内存限制 : 64 MB

题目描述

As everyone knows, the Newton method is an effective way to solve the polynomial ,which follows the basic iterative process below: Xk+1 = Xk - f(xk)/f'(xk) Xk+1 means the value of x at the k+1 step; Xk means the value of x at the k step; f(x) means the value of polynomial; f'(x) means the Derivative of f at x.

输入

There are multiple test cases, each line is a test case. Each test case begins with a number X0 and an integer N(1<=N<=10), which means the degree of the polynomial,then N+1 numbers followed called a0,a1....aN,which indicates the coefficient of X^0,X^1...X^N.

输出

Each test case should output one line. A number with three decimal.

样例输入 Copy

1.01 2 1.00 -2.00 1.00

样例输出 Copy

1.000

来源/分类

tyh