|시간 제한||메모리 제한||제출||정답||맞힌 사람||정답 비율|
|1 초||128 MB||79||39||34||47.222%|
The users feedback for your most beloved open-source operating system is gathered, and guess what the most required feature turned out to be? Yes it is finally what we all have been waiting for so long, extending the built-in calculator functionality! On of the suggested extensions is adding the capability of evaluating polynomials, and that’s what you are thrilled to participate with!
In this problem you’re given a polynomial entered by the user in the calculator and are asked to evaluate it for a certain value.
The first line of input contains T (0 < T <= 100) the number of polynomials, each test cases consists of two lines, the first line contains an integer (-1000 <= X <= 1000), the value for the variable X for which the polynomial is evaluated.
The second line contains a polynomial P with integer coefficients. P is a sum of terms of the form CX^E , where the coefficient C and the exponent E satisfy the following conditions:
For each test case, print the value of polynomial evaluation. The result will fit in a 32-bit signed integer. Follow the output format below.
2 -2 2X^2-5X+7 2 -3X^12+X
Case #1: 25 Case #2: -12286