일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 레벨 1
- 가천대
- 프로그래머스 레벨 2
- 크롤링
- BFS
- 프로그래머스
- Crawling
- 타입스크립트
- type challenge
- 쉬운 문제
- 백준
- Algorithm
- 문자열
- HTTP
- dp
- 타입 챌린지
- 소켓
- javascript
- Nestjs
- HTTP 완벽 가이드
- 자바스크립트
- 알고리즘
- 수학
- socket
- dfs
- Node.js
- TCP
- 그래프
- typescript
- ip
- Today
- Total
목록프로그래밍 (478)
kakasoo
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개를 가져..
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 { const row = line.split(" ").map(Number); graph.push(row); if (graph.length === N) { rl.close(); } } }).on("close", () => { const visited = []; for (let i = 0; i ..
const readline = require("readline"); const rl = readline.createInterface({ input: process.stdin, output: process.stdout, }); rl.on("line", (line) => { main(line); rl.close(); }).on("close", () => { process.exit(); }); const findEmotion = (line, emotion) => { let count = 0; for (let i = 0; i < line.length - 3; i++) { if (line[i] === emotion[0]) { if (line[i + 1] === emotion[1]) { if (line[i + 2]..
// 백준 11365번 !밀비 급일을 풀었습니다. const readline = require("readline"); const rl = readline.createInterface({ input: process.stdin, output: process.stdout, }); const input = []; rl.on("line", (line) => { if (line !== "END") { input.push(line); } else { main(); rl.close(); } }).on("close", () => { process.exit(); }); const main = () => { for (let i = 0; i < input.length; i++) { console.log(input[i].spl..
const readline = require("readline"); const rl = readline.createInterface({ input: process.stdin, output: process.stdout, }); rl.on("line", (line) => { main(line); process.exit(); }); /** * * @param {string} line */ const main = (line) => { let [A, B] = line.split(" ").map(BigInt); if (A > B) { let temp = A; A = B; B = temp; } if (A === B || A + BigInt(1) === B) { console.log(0); return; } let a..
첫번째부터 두번째까지는 버블 정렬을 시도한 것이다. 그런데 시간 초과가 나왔다. 아니, 문제가 버블 정렬인데 버블 정렬 했다고 시간 초과라니, 문제가 잘못된 것 아닌가 해서 봤더니, A에 들어있는 수가 100만까지 나올 수 있다고 한다. 버블 정렬은 O(n^2) 이었으니까 100만의 제곱이면... 아하, 이건 해결할 수 없는 방식이었다. 이 문제는 버블 정렬을 시키진 않을 거면서 버블 정렬을 하면 몇 번이나 걸리는지를 묻는 문제였다. 그래서 방식을 바꾼 게, 버블 정렬이 어떤 조건에서 발생하는지를 보는 것이었다. 버블 정렬을 하면 각 자리 수는 좌측으로 한 칸씩 이동하게 된다. 예를 들어 예제처럼, 10, 1, 5, 2, 3의 숫자가 있다고 해보자. 1, 2, 3, 5, 10으로 정렬되어야 한다. 그러면..
// 백준 2178번 미로 탐색을 풀었습니다. const readline = require("readline"); const rl = readline.createInterface({ input: process.stdin, output: process.stdout, }); let input = []; let N = 0; let M = 0; rl.on("line", (line) => { if (!N) { [N, M] = line.split(" ").map(Number); } else { input.push(line); if (input.length === N) { main(); process.exit(); } } }); const main = () => { const graph = []; const visi..
// 백준 4963번 섬의 개수를 풀었습니다. const readline = require("readline"); const rl = readline.createInterface({ input: process.stdin, output: process.stdout, }); let input = []; let N = 0; let M = 0; rl.on("line", (line) => { if (!N) { if (line === "0 0") { process.exit(); } [M, N] = line.split(" ").map(Number); } else { input.push(line); if (input.length === N) { main(); N = 0; input = []; } } }); const ..
const readline = require("readline"); const rl = readline.createInterface({ input: process.stdin, output: process.stdout, }); const input = []; let count = 0; rl.on("line", (line) => { if (!count) { count = Number(line); } else { input.push(line); if (input.length === count) { main(); process.exit(); } } }); const main = () => { const graph = []; const visited = []; for (let i = 0; i < count; i+..
// 백준 1707번 이분 그래프를 풀었습니다. const readline = require("readline"); const rl = readline.createInterface({ input: process.stdin, output: process.stdout, }); let count = 0; let input = []; rl.on("line", (line) => { if (!count) { count = Number(line); } else { input.push(line); if (input.length == Number(input[0].split(" ")[1]) + 1) { main(); input = []; } } }); const main = () => { const graph = []; ..