Submit | All submissions | Best solutions | Back to list |
EIUPOLY - Polynomial |
Give polynomial P(x)=anxn+ an-1xn-1+ ... + a1x+ a0 and the value of x, find the value of the polynomial.
Input
+ The first line contains the number of testcases T (1<= T <=10^3). Each testcase includes:
+ The value of n và x. (n < 100, x < 1000).
+ The coefficients: an, an-1,... a0 (-1000 <= ai <= 1000).
Output
For each test case, output the value of the polynomial on one row.
Example
Input: 1 2 1 1 2 1 Output: 4
Added by: | Ha Minh Ngoc |
Date: | 2014-12-15 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | CSHARP C++ 4.3.2 CPP CPP14 CPP14-CLANG FSHARP GO JAVA JS-MONKEY NODEJS PHP PYTHON PYPY PYTHON3 RUBY SQLITE SWIFT VB.NET |