const fs = require('fs');
const path = process.platform === 'linux' ? '/dev/stdin' : './input.txt';
const input = fs.readFileSync(path).toString().trim().split('\n');
function solve(input) {
const count = input.length;
for (let i = 0; i < count; i++) {
let numbers = input[i].split(' ').map(Number);
console.log(numbers[0] + numbers[1]);
}
}
solve(input);
// EOF์ ๋ํด์ ๊ณต๋ถํ ๊ฒ
์์ ๊ฐ์ด count๋ฅผ ์ ์ธํ์ฌ ํ๊ธดํ์ง๋ง, ์ฌ์ค ์ด ๋ฌธ์ ์ ์๋๋ EOF(End Of File)๋ฅผ ๊ณ ๋ คํด์ ํธ๋ ๊ฒ์ด๋ค.
EOF์ ๋ํด์๋ ์ด๋ชจ์ ๋ชจ ์นดํ
๊ณ ๋ฆฌ์์ ๋ค๋ฃฐ ์์ !
'๐ JavaScript > ๋ฐฑ์ค' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[JS] 4344 (0) | 2022.05.14 |
---|---|
[JS] 1110 (0) | 2022.05.12 |
[JS] 10871 (0) | 2022.05.11 |
[JS] 2438 (0) | 2022.05.11 |
[JS] 15552 (0) | 2022.05.09 |