11454 - Polynomial Multiplication   

Description

Create a class Polynomial. The internal representation of a Polynomial is an array of terms. Each term contains a coefficient and an exponent, e.g., the term 2x4 has the coefficient 2 and the exponent 4.

 

Provide public member functions that perform Multiplication tasks.

Input

There are four lines.

The first two lines represent the greatest power and the corresponding coefficients of the first polynomial.

The last two lines represent the greatest power and the corresponding coefficients of the second polynomial.

The greatest power is in the range of 0-25.

Note that the coefficients are in descending order and each element is separated by a space.

Output

Output the coefficients of the product of these two polynomials in descending order.

If the result of coefficient is 0, just print it.

Sample Input  Download

Sample Output  Download

Partial Judge Code

11454.cpp

Partial Judge Header

11454.h

Tags




Discuss