题解 | #矩阵乘法#
矩阵乘法
https://www.nowcoder.com/practice/ebe941260f8c4210aa8c17e99cbc663b
while True:
try:
n = int(input())
m = int(input())
k = int(input())
list1 = []
list2 = []
for i in range(n):
list1.append(list(map(int, input().split(' '))))
for j in range(m):
list2.append(list(map(int, input().split(' '))))
list3 = []
for v in range(k):
temp = []
for x in list2:
temp.append(x[v])
list3.append(temp)
# print(list1)
# print(list2)
# print(list3)
for i in list1:
result = []
for j in list3:
numbers = []
for x, y in zip(i, j):
numbers.append(x*y)
result.append(str(sum(numbers)))
print(' '.join(result))
except:
break
叮咚买菜公司氛围 125人发布