题解 | #求小球落地5次后所经历的路程和第5次反弹的高度#

矩阵乘法

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

```while True:
    try:
        row1, col, row2 = int(input()), int(input()), int(input())
        lst1, lst2 = [], []
        for i in range(row1):
            lst1.append(list(map(int, input().split())))
        for i in range(col):
            lst2.append(list(map(int, input().split())))
        res = [[0 for j in range(row2)]for i in range(row1)]
        for i in range(row1):
            for j in range(row2):
                for k in range(col):
                    res[i][j] += lst1[i][k] * lst2[k][j]
                print(res[i][j], end=' ')
            print()
    except:
        break
全部评论

相关推荐

4 收藏 评论
分享
牛客网
牛客企业服务