Matrix Multiplication
InterviewTime limit1sMemory limit128 MB
Read two matrices of bounded size and print their standard matrix product.
- Level
Easy2 of 10
- Topics
- Matrix, Implementation
- Solved
- No attempts yet
Problem
Given an N x M matrix A and an M x K matrix B, write a program that computes the product A x B.
Input
The first line contains the size of matrix A, N and M. The next N lines contain the entries of matrix A, with M integers per row. The following line contains the size of matrix B, M and K. The next M lines contain the entries of matrix B, with K integers per row.
N, M, and K are at most 100, and every matrix entry is an integer whose absolute value is at most 100.
Output
Print the product matrix A x B in N lines. In each line, print K entries separated by spaces.