The Polynomial Equation |
A Polynomial equation of degree n is defined as follows :
A polynomial equation of n degree can have at most n distinct roots which may be both real or complex. Such as a quadratic equation :
The input will start with a positive integer N indicating the number of roots of the polynomial equation. The next line will contain the roots each of which is an integer. N will not exceed 50. Input is terminated by EOF.
You have to show the polynomial using x as a variable. If coeffecient of any term x^i (i > 0) becomes zero then you need not show that term. In case of coeffecient being 1 only print x^i(i > 0). Again if the constant term is zero always use + 0. See sample output for more clarification.
You can be sure that no coeffecient will exceed 10^15.
2 2 3 2 -2 -3 3 0 1 -1
x^2 - 5x + 6 = 0 x^2 + 5x + 6 = 0 x^3 - x + 0 = 0
Md. Kamruzzaman