Solve problem "Multiply two matrices" online - Learn Python 3 - Snakify
Processing math: 100%

Multiply two matrices


Statement

Given three positive integers m, n and r, m lines of n elements, giving an m×n matrix A, and n lines of r elements, giving an n×r matrix B, form the product matrix AB, which is the m×r matrix whose (i,k) entry is the sum A[i][1]B[1][k]++A[i][n]B[n][k] and print the result.
Advertising by Google, may be based on your interests

In all the problems input the data using input() and print the result using print().

# Read an integer:
# a = int(input())
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Input:
3 4 2
0 1 2 3
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Output:
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Saved solutions

Tests

InputCorrect answer
3 4 2
0 1 2 3
4 5 6 7
8 9 10 11
2 3
0 4
5 -1
1 1
13 5
45 33
77 61
2 2 2
1 2
3 4
5 4
3 2
11 8
27 20
1 1 1
5
7
35
4 3 1
1 2 3
4 5 6
7 8 9
10 11 12
1
2
3
14
32
50
68