题解 | #最大乘积#
最大乘积
https://www.nowcoder.com/practice/5f29c72b1ae14d92b9c3fa03a037ac5f
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 let a; let b = []; while ((line = await readline())) { let tokens = line.split(" "); if (!a) { a = parseInt(tokens); } else { b = tokens.map((v) => parseInt(v)); } } b = b.sort((m,n) => { return m - n }) let m = b.length - 1 console.log(Math.max(b[0]*b[1]*b[m],b[m-1]*b[m-2]*b[m])) })();