const fs = require('fs');
const filePath = process.platform === 'linux' ? '/dev/stdin' : './input.txt';
const input = fs.readFileSync(filePath).toString().split('\n');
const countNum = parseInt(input[0]);
for (i = 1; i <= countNum; i++) {
let numbers = input[i].split(' ');
console.log(parseInt(numbers[0]) + parseInt(numbers[1]));
}
๋จ๊ณ ๋ณ ๋ฌธ์ ์ค 3๋จ๊ณ์์ 2๋ฒ์งธ
์์ ๋ฌธ์ ๋ค๊น์ง๋ ์
๋ ฅ์ ๋ํ ๊ณ ๋ฏผ์ด ํฌ๊ฒ ์์์ผ๋ ์ด ๋ฌธ์ ๋ถํฐ ์
๋ ฅ์ ๋ํด ๊ตฌ๊ธ๋งํ๊ธฐ ์์
๋ํ, input.txt ๋ฅผ ๋ง๋ค๊ณ nodemon์ผ๋ก ํ
์คํธํด๋ณด๋ฉด์ ์งํํ ์ ์๊ฒ ๋์๋ค. :) ๊ตณ๊ตณ
'๐ JavaScript > ๋ฐฑ์ค' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[JS] 10951 (0) | 2022.05.12 |
---|---|
[JS] 10871 (0) | 2022.05.11 |
[JS] 2438 (0) | 2022.05.11 |
[JS] 15552 (0) | 2022.05.09 |
[JS] ๋ฐฑ์ค ์ ๋ ฅ๋ฐ๊ธฐ (0) | 2022.05.08 |