Polynomial output
(Poly.pas/c/cpp)
"Problem description"
The unary n-th polynomial can be expressed as follows:
wherein, called i-th term, the AI is called the coefficient of the i-th term. gives the number and system of a unary polynomial
Number, please output the polynomial in the format required as follows:
1. In the polynomial, the argument is x, and the polynomial is given in descending order of the number of times from left to right.
2. Only items with a factor not 0 are included in the polynomial.
3. If the polynomial n coefficient is positive, the polynomial begins with a "+" sign, and if the polynomial n coefficient is negative, the polynomial begins with the "-" sign.
4. For items that are not the highest, connect to the previous item with a "+" or "-", respectively, to indicate that the coefficient is positive or negative. Immediately follows a positive integer that represents the absolute value of this coefficient (if an item is above 0, the absolute value of the coefficient is 1, no output 1 is required). If the exponent of x is greater than 1, the next exponential part is "X^b", where B is the exponent of X, and if the exponent of X is 1, then the exponential part that follows is "X", and if the exponent of x is 0, only the output factor is required.
5. In polynomial, the beginning and end of a polynomial does not contain extra spaces.
Input
Input file name is poly.in, total 2 lines
The first row of 1 integers, n, represents the number of times a unary polynomial is.
The second line has n+1 integers, where the i integer represents the coefficients of the n-i+1, separated by a space between every two integers.
Output
Output file Poly.out A total of 1 lines, according to the format of the title to output the polynomial.
"Data Range"
1≤N≤100, the absolute value of the polynomial coefficients of each polynomial is not more than 100.
Polynomial output (0) <P2009_1>