Type: Default 1000ms 256MiB

矩阵乘法

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

Description

矩阵就是一个二维数组,有行和列之分,矩阵属于线性代数范畴,矩阵在信息学的领域也有很多应用。 矩阵乘法属于矩阵的经典应用

设a,b,c 分别为 m×p(mp),p×nm×n m \times p(m行p列), p \times n和 m \times n 的矩阵。

如果C=a×ba \times b

按照矩阵乘法的定义有:

Input Format

第一行两个整数N1,M1。表示第一个矩阵的行数和列数。

接下来N1行,每行M1个整数.

接下来一行两个整数N2,M2。表示第二个矩阵的行数和列数。

接下来N2行,每行M2个整数.

输入数据保证 M1和N2相等。

Output Format

N1行,每行M2个整数。 表示矩阵相乘之后的二维数组。

Sample

input

2 3  
3 1 2
0 1 5
3 2
4 3 
1 1
6 0

output

25 10
31 1

Hint

保证数据全在1000以内

时间限制:1s1 \text {s}

空间限制:256MB256 \text {MB}

20200818二维数组练习

Not Attended
Status
Done
Rule
ACM/ICPC
Problem
11
Start at
2020-8-18 8:25
End at
2020-8-21 8:25
Duration
72 hour(s)
Host
Partic.
23