题解 | #矩阵乘法#

矩阵乘法

https://www.nowcoder.com/practice/ebe941260f8c4210aa8c17e99cbc663b

while True:
    try:
        x = int(input())
        y = int(input())
        z = int(input())
        A = []
        B = []
        for i in range(x):
            A.append(list(map(int,(input().split()))))
        for j in range(y):
            B.append(list(map(int,(input().split()))))
        for p in range(x):
            for q in range(z):
                a = 0
                for k in range(y):
                    a += A[p][k] * B[k][q] 
                print(a, end = ' ')
            print()
    except:
        break

全部评论

相关推荐

没关系现在见到了、
真的很糟糕:见过国王的offer吗
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务