백준 알고리즘 JS 입출력 정리

Chaeeun Lee·2022년 8월 3일
1

백준 알고리즘

목록 보기
2/7

💡 입력이 한 줄인 경우

const fs = require('fs');
const input = fs.readFileSync('/dev/stdin').toString().trim().split(' ').map(val=>+val)

let [a, b] = input;

💡 입력이 여러 줄이고, 한 줄 안에서 공백이 필요한 경우

const fs = require('fs');
const input = fs.readFileSync('/dev/stdin').toString().split('\n');

let a = parseInt(input[0].split(' ')[0]);
let b = parseInt(input[0].split(' ')[1]);
let c = parseInt(input[1]);

계속 추가중

profile
나는야 뚝딱이 개발자야

0개의 댓글