Javascript + Typescript/자바스크립트로 알고리즘풀기
[백준] 7891
치춘
2023. 7. 17. 22:33
Can you add this?
문제
Given two integers, calculate and output their sum.
입력
The input contains several test cases. The first line contains and integer t (t ≤ 100) denoting the number of test cases. Then t tests follow, each of them consisiting of two space separated integers x and y (−109 ≤ x, y ≤ 109).
출력
For each test case output output the sum of the corresponding integers.
풀이
const add = () => {
const [[n], ...arr] = require("fs")
.readFileSync("/dev/stdin")
.toString()
.trim()
.split("\n")
.map((v) => v.split(" ").map(Number));
for (let val of arr) {
console.log(val[0] + val[1]);
}
};
add();