유물/└ 백준
<백준> 10952번: A+B - 5
디벅잉
2022. 1. 4. 20:51
728x90
🤖
문제
https://www.acmicpc.net/step/2
while문 단계
입력이 끝날 때까지 A+B를 출력하는 문제. EOF에 대해 알아 보세요.
www.acmicpc.net
풀이
const fs = require("fs");
const input = fs.readFileSync("/dev/stdin").toString().split("\n");
let i = 0;
let result = "";
while (input[i].split(" ")[0] > 0) {
let A = parseInt(input[i].split(" ")[0]);
let B = parseInt(input[i].split(" ")[1]);
result += `${A + B}\n`;
i++;
}
console.log(result);
1. (line 9~10) 자바스크립트는 동적 타입 언어이므로 타입 관리에 주의를 기울여야 합니다.
728x90