Matrix Multiplication

Time limit: 5000ms
Memory limit: 256mb

Description:
Given two matrices A and B with size m * n and n * p respectively (1 <= m, n , p <= 50), suppose all elements in the matrices are integers whose absolute value is less than 1000. Calculate result of A * B.

Input:
Matrices A and B are input in the following format.
m n
A_1_1 A_1_2 ... A_1_n
A_2_1 A_2_2 ... A_2_n
 ...   ...  ...  ... 
A_m_1 A_m_2 ... A_m_n
n p
B_1_1 B_1_2 ... B_1_p
B_2_1 B_2_2 ... B_2_p
 ...   ...  ...  ... 
B_n_1 B_n_2 ... B_n_p

Output:
Let C = A * B, you should output matrix C in the following format. 
C_1_1 C_1_2 ... C_1_p
C_2_1 C_2_2 ... C_2_p
 ...   ...  ...  ... 
C_m_1 C_m_2 ... C_m_p

Sample input:
2 2
1 1
-1 1
2 2
1 2
3 4

Sample output:
4 6
2 2

Hints:
Try to implement a Maxtrix ADT.
Submit