题解 | #矩阵乘法#
矩阵乘法
https://www.nowcoder.com/practice/ebe941260f8c4210aa8c17e99cbc663b
# x = int(input())
# y = int(input())
# z = int(input())
# def get_lst(x,y):
# lst1 = []
# for i in range(x):
# tmp = list(map(int,input().split(' ')))
# lst1.append(tmp)
# return lst1
# narray1 = get_lst(x,y)
# narray2 = get_lst(y,z)
# ret = []
# for i in range(len(narray1)):
# tmp = []
# for j in range(len(narray2[0])):
# sum = 0
# for k in range(len(narray1[i])):
# sum += narray1[i][k] * narray2[k][j]
# tmp.append(sum)
# ret.append(tmp)
# for lst1 in ret:
# for num in lst1:
# print(num,end=' ')
# print()
def get_matrix(rows):
return [list(map(int, input().split())) for _ in range(rows)]
x = int(input())
y = int(input())
z = int(input())
matrix1 = get_matrix(x)
matrix2 = get_matrix(y)
result = [
[sum(a * b for a, b in zip(row, col)) for col in zip(*matrix2)] for row in matrix1
]
for row in result:
print(" ".join(map(str, row)))
顺丰集团工作强度 374人发布