Algorithm
- ์ฝ์ -
๋ฌธ์
์์ A๊ฐ N์ ์ฐ์ง ์ฝ์๊ฐ ๋๋ ค๋ฉด, N์ด A์ ๋ฐฐ์์ด๊ณ , A๊ฐ 1๊ณผ N์ด ์๋์ด์ผ ํ๋ค.
์ด๋ค ์ N์ ์ง์ง ์ฝ์๊ฐ ๋ชจ๋ ์ฃผ์ด์ง ๋, N์ ๊ตฌํ๋ ํ๋ก๊ทธ๋จ์ ์์ฑํ์์ค.
์ ์ถ๋ ฅ ์์
๋ฌธ์ ํ๊ธฐ
const readline = require("readline");
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
let input = [];
rl.on("line", function (line) {
input.push(
line
.toString()
.split(" ")
.map((el) => +el)
);
}).on("close", function () {
input = input[1];
input.sort((a, b) => a - b);
console.log(input[0] * input[input.length - 1]);
process.exit();
});
๋ฐ์ํ
'๊ฐ์ธ๊ณต๋ถ > Algorithm' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[๋ฐฑ์ค][Node.js] 1085๋ฒ : ์ง์ฌ๊ฐํ์์ ํ์ถ (0) | 2021.06.29 |
---|---|
[๋ฐฑ์ค][Node.js] 1057๋ฒ : ํ ๋๋จผํธ (0) | 2021.06.28 |
[๋ฐฑ์ค][Node.js] 1026๋ฒ : ๋ณด๋ฌผ (0) | 2021.06.26 |
[๋ฐฑ์ค][Node.js] 1408๋ฒ : 24 (0) | 2021.06.25 |
[๋ฐฑ์ค][Node.js] 1373๋ฒ : 2์ง์ 8์ง์ (0) | 2021.06.24 |
๋๊ธ