IT/Baekjoon Oline Judge
[BOJ] 10951번 - A+B - 4
개발자희망생고롸파덕
2023. 8. 16. 18:40
사용언어 : javascript - node.js
# 제출 코드
const fs = require('fs');
const filePath = process.platform === 'linux' ? '/dev/stdin' : './input.txt';
let input = fs.readFileSync(filePath).toString().split('\n');
const testCaseArray = [];
for (let i = 0; i < input.length; ++i) {
if (input[i] === '') {
break;
}
const tempValue = input[i].split(' ').map((item) => +item);
testCaseArray.push({ A: tempValue[0], B: tempValue[1] });
}
solution(testCaseArray);
function solution(testCaseArray) {
let a = 0;
let b = 0;
let idx = 0;
while (idx < testCaseArray.length) {
a = testCaseArray[idx].A;
b = testCaseArray[idx].B;
console.log(a + b);
idx++;
}
}