P17928 [GeeksforGeeks] Multiply 2 matrices4144
普及-
题目描述

For 2 given matrices of size n x n. Your task is to multiply them.

Example 1:​
​Input:
matrixA = {{1, 1, 1}, {1, 1, 1},
{1, 1, 1}}
matrixB = {{1, 1, 1}, {1, 1, 1},
{1, 1, 1}}
Output: {{3, 3, 3}, {3, 3, 3}, {3, 3, 3}}
Example 2:
Input:
matrixA = {{1, 2}, {3, 4}},
matrixB = {{4, 3}, {2, 1}}
Output: {{8, 5}, {20, 13}}

Your Task:
You don't need to read or print anything. Your task is to complete the function Multiply() which takes two matrices matrixA amd matrixB as input parameter and multiply the two matrices. You don't have to return anything. Copy the values of output matrix into matrixA.

Expected Time Compelxity: O(n^{3})
Expected Space Complexity: O(n^{2})

Constraints:
1 <= n <= 100
1 <= elements of matrices <= 100

输入格式

见题面

输出格式

见题面

样例输入
matrixA = {{1, 1, 1}, {1, 1, 1}, {1, 1, 1}} matrixB = {{1, 1, 1}, {1, 1, 1}, {1, 1, 1}}
样例输出
{{3, 3, 3}, {3, 3, 3}, {3, 3, 3}}