题解 | #矩阵乘法#
矩阵乘法
https://www.nowcoder.com/practice/ebe941260f8c4210aa8c17e99cbc663b
x=int(input()) y=int(input()) z=int(input()) # x*y矩阵 a=[] for i in range(x): n=list(map(int,input().split())) a.append(n) #print(a) # y*z矩阵 b=[] for i in range(y): m=list(map(int,input().split())) b.append(m) #print(b) #x:1-2 y:1-3 z:1-2 res=[[0]*z]*x #res[i][j]=sum 出错,同时更新每行的第j个???? for i in range(x): for j in range(z): sum=0 for k in range(y): a1=a[i][k] b1=b[k][j] product=a1*b1 sum += product print(sum,end=' ') print()