题解 | #矩阵乘法#
矩阵乘法
http://www.nowcoder.com/practice/ebe941260f8c4210aa8c17e99cbc663b
while True: try: x,y,z,A,B=int(input()),int(input()),int(input()),[],[] for i in range(x): A.append(list(map(int, input().split()))) #读入矩阵A for i in range(y): B.append(list(map(int, input().split()))) #读入矩阵B C ,tmp= [],0 for i in range(x): # A行 for j in range(z): #B列 for k in range(y): #A列,B行 tmp += A[i][k]*B[k][j] #循环进行进行矩阵乘法(A行*B列) C.append(tmp) #保存每个元素tmp到矩阵C中 tmp = 0 for i in range(x): print(' '.join(list(map(str,C[i*z:(i+1)*z])))) except: break