#B2105. Matrix Multiplication
Matrix Multiplication
Matrix Multiplication
Given two matrices, compute their product. The problem is defined as follows: Let \(A\) be an \(n \times m\) matrix and \(B\) be an \(m \times k\) matrix. Their product \(C = A \times B\) is an \(n \times k\) matrix where each element is computed as follows:
\[ C[i][j] = A[i][0] \times B[0][j] + A[i][1] \times B[1][j] + \cdots + A[i][m-1] \times B[m-1][j] \]
where \(C[i][j]\) indicates the element in the \(i\)-th row and \(j\)-th column of matrix \(C\).
inputFormat
The first line of input contains three integers \(n\), \(m\), and \(k\) representing the dimensions of the matrices. The next \(n\) lines each contain \(m\) integers representing the rows of matrix \(A\). The following \(m\) lines each contain \(k\) integers representing the rows of matrix \(B\).
outputFormat
Output the resulting matrix \(C\) in \(n\) lines, where each line contains \(k\) integers separated by a space.
sample
2 2 2
1 2
3 4
5 6
7 8
19 22
43 50
</p>