전체 글

-
문제 번호 : 1759 번 문제 바로가기 ☞ https://www.acmicpc.net/problem/1759 const fs = require("fs"); const { resourceLimits } = require("worker_threads"); const filePath = process.platform === "linux" ? "/dev/stdin" : "./input.txt"; let input = fs.readFileSync(filePath).toString().trim().split("\n"); let [N, M] = input[0].split(" ").map(Number); let dicArr = input[1].split(" "); dicArr.sort(); // 오름차순용 정렬 le..
[BaekJoon] 1759 번 암호 만들기 문제 - (nodejs)문제 번호 : 1759 번 문제 바로가기 ☞ https://www.acmicpc.net/problem/1759 const fs = require("fs"); const { resourceLimits } = require("worker_threads"); const filePath = process.platform === "linux" ? "/dev/stdin" : "./input.txt"; let input = fs.readFileSync(filePath).toString().trim().split("\n"); let [N, M] = input[0].split(" ").map(Number); let dicArr = input[1].split(" "); dicArr.sort(); // 오름차순용 정렬 le..
2022.01.28 -
문제 번호 : 14888번 문제 바로가기 ☞ https://www.acmicpc.net/problem/14888 const fs = require("fs"); const filePath = process.platform === "linux" ? "/dev/stdin" : "./input.txt"; let input = fs.readFileSync(filePath).toString().trim().split("\r\n"); // object function const operObj = { "+": (oper1, oper2) => oper1 + oper2, "-": (oper1, oper2) => oper1 - oper2, "*": (oper1, oper2) => oper1 * oper2, "/": (ope..
[BaekJoon] 14888번 연산자 끼워넣기 문제 - (nodejs)문제 번호 : 14888번 문제 바로가기 ☞ https://www.acmicpc.net/problem/14888 const fs = require("fs"); const filePath = process.platform === "linux" ? "/dev/stdin" : "./input.txt"; let input = fs.readFileSync(filePath).toString().trim().split("\r\n"); // object function const operObj = { "+": (oper1, oper2) => oper1 + oper2, "-": (oper1, oper2) => oper1 - oper2, "*": (oper1, oper2) => oper1 * oper2, "/": (ope..
2022.01.27 -
문제 번호 : 1182 번 문제 바로가기 ☞ https://www.acmicpc.net/problem/1182 const fs = require("fs"); const filePath = process.platform === "linux" ? "/dev/stdin" : "./input.txt"; let input = fs.readFileSync(filePath).toString().trim().split("\n"); const comb = (count, originArr, inArr) => { if (count === -1) return; if (inArr.length >= 1) { if (inArr.reduce((a, b) => a + b) === target) cnt++; } for (let i = ..
[BaekJoon] 1182 번 부분수열의 합 문제 - (nodejs)문제 번호 : 1182 번 문제 바로가기 ☞ https://www.acmicpc.net/problem/1182 const fs = require("fs"); const filePath = process.platform === "linux" ? "/dev/stdin" : "./input.txt"; let input = fs.readFileSync(filePath).toString().trim().split("\n"); const comb = (count, originArr, inArr) => { if (count === -1) return; if (inArr.length >= 1) { if (inArr.reduce((a, b) => a + b) === target) cnt++; } for (let i = ..
2022.01.27 -
문제 번호 : 15652 번 문제 바로가기 ☞ https://www.acmicpc.net/problem/15652 const fs = require("fs"); const filePath = process.platform === "linux" ? "/dev/stdin" : "./input.txt"; let input = fs.readFileSync(filePath).toString().trim().split("\n"); const comb = (count, originArr, inArr) => { if (count === 0) { combArr.push(...[inArr.join(" ")]); return; } for (let i = 0; i < originArr.length; i++) { let tem..
[BaekJoon] 15652 번 N과 M (4) 문제 - (nodejs)문제 번호 : 15652 번 문제 바로가기 ☞ https://www.acmicpc.net/problem/15652 const fs = require("fs"); const filePath = process.platform === "linux" ? "/dev/stdin" : "./input.txt"; let input = fs.readFileSync(filePath).toString().trim().split("\n"); const comb = (count, originArr, inArr) => { if (count === 0) { combArr.push(...[inArr.join(" ")]); return; } for (let i = 0; i < originArr.length; i++) { let tem..
2022.01.27 -
문제 이름 : [1차] 비밀지도 function solution(n, arr1, arr2) { let answer = []; for(let i=0; i
[Programmers] X 번 X 문제 - (javascript)문제 이름 : [1차] 비밀지도 function solution(n, arr1, arr2) { let answer = []; for(let i=0; i
2022.01.26 -
문제 이름 : 실패율 function solution(N, stages) { let answer = []; let users = stages.length; for(let i=1; i el===i).length; answer.push([i, stageLevelFilter/users]); users -= stageLevelFilter } answer.sort((a, b) => b[1] - a[1]); return answer.map(el=> el[0]); } * 코드는 짧지만.. 처음엔 생각보다 하드코딩하고 틀려버렸다. 5번째 스테이지까지 있을때 4번까지만 결과가 있고, 5번은 없는 경우 5번은 NaN이 나와서 이를 예외처리한다고 isNaN을 사용해 처리해서 '0'으로 해야하는데 잘못보고 '1'로 하고 정답..
[Programmers] 실패율 문제 - (javascript)문제 이름 : 실패율 function solution(N, stages) { let answer = []; let users = stages.length; for(let i=1; i el===i).length; answer.push([i, stageLevelFilter/users]); users -= stageLevelFilter } answer.sort((a, b) => b[1] - a[1]); return answer.map(el=> el[0]); } * 코드는 짧지만.. 처음엔 생각보다 하드코딩하고 틀려버렸다. 5번째 스테이지까지 있을때 4번까지만 결과가 있고, 5번은 없는 경우 5번은 NaN이 나와서 이를 예외처리한다고 isNaN을 사용해 처리해서 '0'으로 해야하는데 잘못보고 '1'로 하고 정답..
2022.01.25