치춘짱베리굿나이스

[백준] 7891 본문

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();

'Javascript + Typescript > 자바스크립트로 알고리즘풀기' 카테고리의 다른 글

[백준] 27294  (0) 2023.07.18
[백준] 27323  (0) 2023.07.17
[백준] 6840  (0) 2023.07.16
[백준] 4470  (0) 2023.07.14
[백준] 2393  (0) 2023.07.05
Comments