题解 | #矩阵乘法#
矩阵乘法
http://www.nowcoder.com/practice/ebe941260f8c4210aa8c17e99cbc663b
Javascript代码,线性代数基础
let x = parseInt(readline()) let y = parseInt(readline()) let z = parseInt(readline()) let A = [], B = [] let m=x,n=y let res = [] while(m--){ let temp = readline().split(' ') A.push(temp.map(Number)) } while(n--){ let temp = readline().split(' ') B.push(temp.map(Number)) } for(let i = 0;i<x;i++){ let temp = [] for(let j=0;j<z;j++){ let num = 0 for(let k=0;k<y;k++){ num+=A[i][k]*B[k][j] } temp.push(num) } res.push(temp.slice(0)) } res.forEach(item=>{ print(item.join(' ')) })