#K7031. Matrix Multiplication
Matrix Multiplication
Matrix Multiplication
You are given two matrices A and B. Matrix A has dimensions \(N \times M\) and matrix B has dimensions \(M \times K\). Your task is to compute the matrix multiplication \(C = A \times B\), where \(C\) will have dimensions \(N \times K\).
The formula for the element \(C_{i,j}\) is given by:
[ C_{i,j} = \sum_{k=1}^{M} A_{i,k} \times B_{k,j} ]
It is guaranteed that the given matrices can be multiplied. The input is provided in a standard format, and your output should also be in the standard format.
inputFormat
The first line contains three integers \(N\), \(M\), and \(K\), indicating the dimensions of the matrices. The next \(N\) lines each contain \(M\) integers representing matrix A. The following \(M\) lines each contain \(K\) integers representing matrix B.
outputFormat
Print the resultant matrix \(C\) with \(N\) lines. Each line should contain \(K\) integers separated by a single space.
## sample2 3 2
1 2 3
4 5 6
7 8
9 10
11 12
58 64
139 154
</p>