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 :
has two roots 2 and 3. In this problem you have to generate such a polynomial equation whose roots are already given.
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 coefficient 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.
範例輸入 1
2 2 3 2 -2 -3 3 0 1 -1
範例輸出 1
x^2 - 5x + 6 = 0 x^2 + 5x + 6 = 0 x^3 - x + 0 = 0
Pro 專屬功能: 查看這題在歷屆 CPE 出現過幾次 — 升級以解鎖.