1442 - I2P (II) 2018_Chen_HW3 Scoreboard

Time

2018/04/24 14:30:00 2018/05/04 13:30:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
11408 Polynomial Computation
11414 Matrix Computation

11408 - Polynomial Computation   

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 each of the following tasks:

  1. Adding two Polynomial.
  2. Subtracting two Polynomial.
  3. Multiplying two Polynomial.

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 sum, difference and product of these two polynomials in descending order.

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

ex:

2

1 2 1

0

0

The answer will be :

1 2 1

1 2 1

0 0 0

Note that there is a new line character at the end of each answer.

Sample Input  Download

Sample Output  Download

Partial Judge Code

11408.cpp

Partial Judge Header

11408.h

Tags




Discuss




11414 - Matrix Computation   

Description

Create a class Matrix to represent an N x N matrix.

Provide public member functions that perform or derive:

  1. Interchanging two rows.
  2. Rotating Matrix by 90° clockwise.
  3. Rotating Matrix by 90° counter clockwise.
  4. Checking if Matrix is symmetric or not. If yes, print “yes”, otherwise, print “no”.

Hint:

  • Symmetric

A matrix A = (aij) is symmetric if its entries are symmetric with respect to the main diagonal, that is, aij = aji, for all indices i and j.

The following 3 x 3 matrix is symmetric:

1 7 3

7 4 -5

3 -5 6

Input

The first line contains an integer N (2<=N<=50), which means the size of the matrix. The total number of elements in the matrix is thus N x N.

For the next N lines, each line contains N integers, specifying the elements of the matrix.

The last line has two integers, which mean two row indices for performing row exchange.

All of the integers in the same line are separated by a space.

Output

Print out the corresponding results with a new line character at the end of each result.

Sample Input  Download

Sample Output  Download

Partial Judge Code

11414.cpp

Partial Judge Header

11414.h

Tags




Discuss