题解 | #矩阵乘法#
矩阵乘法
http://www.nowcoder.com/practice/ebe941260f8c4210aa8c17e99cbc663b
用一维数组计算
x=int(input().strip())
y=int(input().strip())
z=int(input().strip())
A,B=[],[]
for i in range(x):
line=list(map(int, input().strip().split()))
A.extend(line)
for i in range(y):
line=list(map(int, input().strip().split()))
B.extend(line)
for i in range(x*z):
dx=i%z #0,z-1
dy=i//z #0,x-1
s=0
for j in range(y):
s+=A[dy*y+j]*B[j*z+dx]
if i%z==0 and i!=0:
print("")
print(s, end=" ")