IT/알고리즘

    [node.js] 백준 15552번 빠른 A+B

    [node.js] 백준 15552번 빠른 A+B

    백준 15552번 빠른 A+B 문제 node.js 풀이입니다. [node.js] 백준 15552번 빠른 A+B 반복문 시 입출력 방식에 따른 시간초과 문제 단계별 문제에서 시간초과를 고려한 첫 문제이다. 반복문 사이클 마다 출력 const fs = require("fs"); let input = fs .readFileSync('/dev/stdin') // boj: '/dev/stdin' .toString() .split("\n"); const count = parseInt(input[0]); function solution() { for (let i = 1; i < count + 1; i++) { const nums = input[i].split(" "); const firstNum = parseInt(..

    [node.js] 백준 14681번 사분면 고르기

    [node.js] 백준 14681번 사분면 고르기

    백준 번 문제 node.js 풀이입니다. [node.js] 백준 14681번 사분면 고르기: 런타임 에러 fs 사용으로 인한 런타임에러 readline을 사용해 풀어야 함. fs모듈을 사용한 풀이 const fs = require("fs"); const input = fs .readFileSync('/dev/stdin') .toString() .split("\n"); const x = parseInt(input[0]); const y = parseInt(input[1]); function solution() { if (x > 0 && y > 0) { console.log("1"); } else if (x 0) { console.log("2"); } else if (x < 0 && y ..

    [node.js] 백준 9498번 시험 성적

    백준 9498번 새싹 문제 node.js 풀이입니다. [node.js] 백준 9498번 시험 성적 python에선 허용하는 문법인데 javascript에선 안된다... 1 < a < 2 비교식을 이용한 풀이 function solution() { if (90

    [node.js] 백준 25083번 새싹

    [node.js] 백준 25083번 새싹

    백준 25083번 새싹 문제 node.js 풀이입니다. [node.js] 백준 25083번 새싹 vscode 출력을 확인했을 때 출력과 똑같았는데 계속 오류가 나왔다... 백틱(`)을 사용한 풀이 console.log(` ,r'"7 r\`-_ ,' ,/ \\. ". L_r' \`~\\/ | | `); ?????????? 뭐가 문제죠 따옴표 풀이 console.log( " ,r'\"7\nr`-_ ,' ,/\n \\. \". L_r'\n `~\\/\n |\n |" ); ?????????? 이건 왜 맞죠 오답 이유 당연히 백틱, 따옴표로 모두 풀 수 있는 문제였고 오답의 이유는 출력을 비교해 보았다. 앞에 여백의 문제였다. 백틱 사용 시 백준 예제 출력을 복사하고 그대로 붙여 넣었는데 function solu..