题解 | #矩阵乘法#
矩阵乘法
https://www.nowcoder.com/practice/ebe941260f8c4210aa8c17e99cbc663b
62ms
while True:
try:
i, k, j = int(input()), int(input()), int(input())
A = [list(map(int, input().split())) for _ in range(i)]
B = [list(map(int, input().split())) for _ in range(k)]
for ii in range(i):
Ai = A[ii][:]
for jj in range(j):
Bj = [bj[jj] for bj in B]
print(sum(list(map(lambda x, y: x*y, Ai, Bj))), end=' ')
print()
except EOFError:
break
查看12道真题和解析