일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
- 백준
- 쉬운 문제
- typescript
- dfs
- HTTP 완벽 가이드
- 소켓
- 크롤링
- socket
- Algorithm
- dp
- HTTP
- Node.js
- 레벨 1
- javascript
- 프로그래머스 레벨 2
- 수학
- ip
- 문자열
- type challenge
- BFS
- Crawling
- 타입스크립트
- 그래프
- Nestjs
- TCP
- 자바스크립트
- 알고리즘
- 프로그래머스
- 타입 챌린지
- 가천대
- Today
- Total
목록백준 (100)
kakasoo

const readline = require("readline"); const rl = readline.createInterface({ input: process.stdin, output: process.stdout, }); const input = []; rl.on("line", (line) => { input.push(line); }).on("close", () => { main(); }); /** * * @param {number} curNumber * @param {number[]} brokenButtons */ const checkNum = (curNumber, brokenButtons) => { const numbers = curNumber.toString().split("").map(Numb..

const readline = require("readline"); const rl = readline.createInterface({ input: process.stdin, output: process.stdout, }); rl.on("line", (line) => { const [E, S, M] = line.split(" ").map(Number); let e = 1; let s = 1; let m = 1; let count = 1; while (true) { if (E === e && S === s && M === m) { console.log(count); return; } e++; s++; m++; count++; if (e > 15) { e = 1; } if (s > 28) { s = 1; }..

귀찮아서 때려 박듯이 풀었다. const readline = require("readline"); const rl = readline.createInterface({ input: process.stdin, output: process.stdout, }); const people = []; rl.on("line", (line) => { people.push(line); if (people.length === 9) { main(people); } }); /** * * @param {string[]} people */ const main = (people) => { const heights = people.map(Number).sort((a, b) => a - b); const sum = heights.red..

const readline = require("readline"); const rl = readline.createInterface({ input: process.stdin, output: process.stdout, }); rl.on("line", (line) => { let [a, b, c] = line.split(" ").map(BigInt); const pow = (a, b, c) => { if (b == 0) { return BigInt(1); } const temp = pow(a, BigInt(parseInt(b / BigInt(2))), c); if (b % BigInt(2)) { return (((temp * temp) % c) * a) % c; } else { return (temp * ..

const readline = require("readline"); const rl = readline.createInterface({ input: process.stdin, output: process.stdout, }); rl.on("line", (line) => { main(line); }).on("close", () => process.exit()); /** * * @param {string} line */ const main = (line) => { const [N, K] = line.split(" ").map(Number); const arr = new Array(N).fill(0).map((el, i) => i + 1); let answer = "

const readline = require("readline"); const rl = readline.createInterface({ input: process.stdin, output: process.stdout, }); let N = 0; const input = []; rl.on("line", (line) => { if (!N) { N = Number(line); } else { input.push(line); if (input.length === N - 1) { main(); } } }); const main = () => { const graph = []; const answer = []; for (let i = 1; i { const [from, to] = edge.split(" "); gr..

const readline = require("readline"); const rl = readline.createInterface({ input: process.stdin, output: process.stdout, }); rl.on("line", (line) => { main(line); }); /** * * @param {string} line */ const main = (line) => { let small = 0; let big = 0; let num = 0; let space = 0; for (let i = 0; i < line.length; i++) { const cur = line[i]; if (!isNaN(cur - 0)) { if (cur === " ") { space++; } els..

const readline = require("readline"); const rl = readline.createInterface({ input: process.stdin, output: process.stdout, }); rl.on("line", (line) => { let answer = ""; for (let i = 0; i < line.length; i++) { answer += line[i]; if (answer.length === 10) { console.log(answer); answer = ""; } } console.log(answer); });

시간 초과를 해결했더니, 공간 복잡도가 높아지는 문제가 있었다. 일반적으로, dfs로 해서 해결될만한 문제 같은데, 35% 이상을 넘어가면 런타임 에러가 발생했다. ( 중간에 CannotFindModule은 자동완성 때문에 그러하다. ) 내 개인적인 생각으로는, 스택 영역이 고갈되었기 때문이다. 사실, StackSizeExceeded라고 써있으니 당연한 거 아닌가, 생각할 수 있겠지만, 그래도 생각해볼 부분이 나름 있다. 자바스크립트의 변수는 다른 언어들보다 좀 크다. 숫자의 경우의 8바이트, 기본적으로 모든 숫자가 double이기 때문이다. 그러니깐 잘 짜려고 노력해도 남들보다 변수를 2배 이상 가지고 있으니, 똑같은 함수여도 가끔씩 stack이 고갈된다. 따라서 정적인 영역 ( 데이터 영역 )으로 조..

const readline = require("readline"); const rl = readline.createInterface({ input: process.stdin, output: process.stdout, }); const graph = []; let N, M; rl.on("line", (line) => { if (!N) { [N, M] = line.split(" ").map(Number); } else { graph.push(line.split("")); if (graph.length === N) { main(); process.exit(); } } }); const main = () => { let visited = []; const xMove = [0, 0, -1, 1]; const y..

const readline = require("readline"); const rl = readline.createInterface({ input: process.stdin, output: process.stdout, }); const graph = []; let [N, M] = [0, 0]; rl.on("line", (line) => { if (!N) { [N, M] = line.split(" ").map(Number); } else { graph.push(line.split(" ").map(Number)); if (graph.length === N) { main(); process.exit(); } } }); const main = () => { let visited = []; const xMove ..

const readline = require("readline"); const rl = readline.createInterface({ input: process.stdin, output: process.stdout, }); rl.on("line", (line) => { main(Number(line)); process.exit(); }); const main = (line) => { const answer = line % 4; if (answer === 1) { console.log("CY"); } else if (answer === 3) { console.log("CY"); } else { console.log("SK"); } }; 상식적으로 당연하지 않나. 1개를 가져가면 상대는 3개, 3개를 가져..