-->
当前位置:首页 > 题库

PROGRAMMING:Polynomial summation

Luz5年前 (2021-05-10)题库389
Write algorithm to find the value of one variable polynomial $$p_ n(x)=\sum_{ i=0}^{n}a_ Value of IX ^ I $$$p_ n(x_ 0)$$。
**Note: do not use built-in exponentiation functions, such as pow () in C, \ * \ * in Python, etc**
###Input format:
The first line is an integer $$n $$and a floating-point number $$X_ 0$$。 Where $$0-leq-n-leq-30000 represents the degree of polynomial$$ x_ 0 $$is the value of the variable $$x $$in the polynomial.
The second line is the $$n + 1 $$floating-point number divided by spaces, which represents the coefficients of the terms in the polynomial from high to low.
You can assume that the input is always legal.
###Output format:
Output polynomial evaluation results, retain three decimal places, end with a new line.
###Input example:
For example:
```in
3 1.0
1 2 3 4
```
The corresponding polynomial is $$p (x) = x ^ 3 + 2x ^ 2 + 3x + 4 $$, and the independent variable is $$x = 1.0 $$.
###Output example:
The output is
```out
ten
```







answer:If there is no answer, please comment