[JS] 백준 10950번 A+B - 3

jsg_ko·2021년 11월 10일
0

코테연습

목록 보기
3/21
const fs = require("fs"); //파일받기위해 필요
const localFile = fs.existsSync("./input.txt"); // 내가 알고리즘 풀려는 폴더에 './input.txt'의 유무를 참,거짓으로 변수에 넣어라
const filePath = () => {
  // 참이면 내 input파일을 열고 그외는 백준의 알고리즘에서 주는 입력값을 받겠다.
  if (localFile) {
    return "./input.txt";
  }
  return "/dev/stdin";
};
var input = fs.readFileSync(filePath()).toString().trim().split('\n');

const T = Number(input[0])

for (let i = 0; i < T; i++){
  console.log( Number(input[i + 1].split(' ')[0]) + Number(input[i + 1].split(' ')[1]) )
} 

자야돼서 다른사람 풀이 보는거는 패스.. 졸리다

profile
디버깅에서 재미를 추구하면 안되는 걸까

0개의 댓글

Powered by GraphCDN, the GraphQL CDN