๊ฐ์ธ๊ณต๋ถ/Algorithm
[๋ฐฑ์ค][Node.js] 5988๋ฒ : ํ์์ผ๊น ์ง์์ผ๊น
๐๋ฐ๋ด๋ด๐
2021. 12. 1. 23:09
Algorithm
- ํ์์ผ๊น ์ง์์ผ๊น -
๋ฌธ์
์ง์ด ์๋ ๊ฒฝ์ฌ๋ ๋งค์ผ ํ๋ก ์๋ค๋ณด๋ ํ์๋ฅผ ํ๋ณํ ์ ์๋ ๋ฅ๋ ฅ์ด ์๊ฒผ๋ค. ์ฐฝ์์ด๋ ๊ฒฝ์ฌ์ ๋ง์ด ์ฌ์ค์ธ์ง ๊ทธ ๋ฅ๋ ฅ์ ์ํํด๋ณด๋ ค ํ๋ค. ์ฐฝ์์ด์ ์์ฌ์ด ๋์ด ์์ ๊ฒ ๊ฐ์ 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(BigInt(line));
}).on("close", function () {
for(let i = 1; i < input.length; i++) {
if(Number(String(input[i]).slice(-1)) % 2 === 0) {
console.log('even');
}
else console.log('odd');
}
process.exit();
});
๋ฐ์ํ