题解 | #矩阵元素相乘#
矩阵元素相乘
https://www.nowcoder.com/practice/935fbb71542345ef87a7acc190e2577b?tpId=182&tqId=34667&rp=1&ru=/exam/oj&qru=/exam/oj&sourceUrl=%2Fexam%2Foj%3Fpage%3D1%26tab%3D%25E5%2590%258D%25E4%25BC%2581%25E7%259C%259F%25E9%25A2%2598%26topicId%3D182&difficulty=undefined&judgeStatus=undefined&tags=&title=
const rl = require("readline").createInterface({ input: process.stdin }); var iter = rl[Symbol.asyncIterator](); const readline = async () => (await iter.next()).value; void async function () { // Write your code here while(line = await readline()){ line0 = line.split(' '); line0Int = line0.map(Number); linen = new Array; for(let i=0; i<line0Int[0]; i++){ matrixlinen = await readline(); matrixlinens = matrixlinen.split(' '); matrixlinensInt = matrixlinens.map(Number); linen.push(matrixlinensInt); } matrix = linen; let max =0; for(let i=0; i<line0Int[0]; i++){ for(let j=0; j<line0Int[1]; j++){ let xijm = 1; for(let m=0; m<line0Int[1]; m++){ if(m!=j){ xijm *= matrix[i][m]; } } for(let n=0; n<line0Int[0]; n++){ if(n!=i){ xijm *= matrix[n][j]; } } result = xijm; max = Math.max(max, result); } } console.log(max); } }()