Matrices and grids · 12 / 15 Exercise Hard

Matrix product

Objective

To multiply A (n×m) by B (m×p), each element of the result is the dot product of a row of A by a column of B. The result has n×p elements.

Instructions

  • The first line has n m p; then come the n rows of A and the m rows of B, with space-separated integers.
  • Show the product matrix, one row per line.
Input
2 2 2
1 2
3 4
0 1
1 0
Output
2 1
4 3

Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.

Start exercise