Matrix Multiplication


Submit solution

Points: 1
Time limit: 1.0s
Memory limit: 64M

Author:
Problem type
Allowed languages
C, C++, Python3

In this problem, you will design a programme that performs matrix multiplication. It is recommended that you design a function to do so.

For any two given matrix \(A, B\) of dimension \(N \times M\) and \(M \times L\), the product matrix is a matrix \(C\) of dimension \(N \times L\), and the equation for such computation is:

\(c_{ij} = \sum_k{a_{ik} \cdot b_{kj}}\)

For Python formatting

Use format to preserve two decimal digits.

"{:.2f}".format(a_float)

Input Specification

The first line will contain one integer \(T\), which is the number of test cases in the problem (\(1<T<50\)).

For each test case, the first line will contain 3 integers \(N, M, L\) (\(1<N,M,L<500\)), indicating the dimension size of matrices.

The next \(N\) line will give the value for matrix \(A\), each line \(M\) values separated by a single space.

The next \(M\) line will give the value for matrix \(B\), each line \(L\) values separated by a single space.

Matrix values could be float or integer.

Test cases are separated by a blank line.

Output Specification

Test cases should be separated by a blank line.

For the output of each test case, output \(N\) lines, each \(L\) values separated by a single space. Each number should show 2 digits after decimal point.

Sample Input

2
2 3 4
1 2 3
4 5 6
1 2 3 4
5 6 7 8
9 10 11 12

2 2 2
1.2 1.2
1.3 1.3
1 0
0 1

Sample Output

38.00 44.00 50.00 56.00
83.00 98.00 113.00 128.00

1.20 1.20
1.30 1.30

Comments

There are no comments at the moment.