Algorithm
- ๋ฐฐ์ ์ฐพ๊ธฐ -
๋ฌธ์
์ ์ n(0 < n < 1000)๊ณผ ์์ ๋ชฉ๋ก์ด ์ฃผ์ด์ก์ ๋, ๋ชฉ๋ก์ ๋ค์ด์๋ ์๊ฐ 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());
}).on("close", function () {
input = input.map((el) => Number(el));
let number = input.shift();
for (let i = 0; i < input.length - 1; i++) {
if (input[i] % number === 0) console.log(`${input[i]} is a multiple of ${number}.`);
else console.log(`${input[i]} is NOT a multiple of ${number}.`);
}
process.exit();
});
๋ฐ์ํ
'๊ฐ์ธ๊ณต๋ถ > Algorithm' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[๋ฐฑ์ค][Node.js] 4949๋ฒ : ๊ท ํ์กํ ์ธ์ (0) | 2021.10.28 |
---|---|
[๋ฐฑ์ค][Node.js] 4673๋ฒ : ์ ํ ๋๋ฒ (0) | 2021.10.27 |
[๋ฐฑ์ค][Node.js] 4458๋ฒ : ์ฒซ ๊ธ์๋ฅผ ๋๋ฌธ์๋ก (0) | 2021.10.25 |
[๋ฐฑ์ค][Node.js] 4344๋ฒ : ํ๊ท ์ ๋๊ฒ ์ง (0) | 2021.10.23 |
[๋ฐฑ์ค][Node.js] 4153๋ฒ : ์ง๊ฐ์ผ๊ฐํ (0) | 2021.10.21 |
๋๊ธ