Polynomial output (0) <P2009_1>

Source: Internet
Author: User

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>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.