- 1. Input, print and numbers
- 2. Integer and float numbers
- 3. Conditions: if, then, else
- 4. For loop with range
- 5. Strings
- 6. While loop
- 7. Lists
- 8. Functions and recursion
- 9. Two-dimensional lists (arrays)
- 10. Sets
- 11. Dictionaries
- 12. JavaScript
- 13. HTML5 and CSS
- 14. Responsive Design with Bootstrap
- 15. jQuery
Ad place
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.In all the problems input the data using input()
and print the result using print()
.
12# Read an integer:# a = int(input())XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Input:
3 4 20 1 2 3XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Output:
1XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Saved solutions
Tests
Input | Correct 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 |