본문 바로가기

알고리즘/백준4

[백준] 1934번: 최소공배수 (JavaScript, node.js) [백준] 1934번: 최소공배수 (JavaScript, node.js)https://www.acmicpc.net/problem/1934https://github.com/jwc406/algorithm_Solving/tree/main/%EB%B0%B1%EC%A4%80/%EC%B5%9C%EC%86%8C%EA%B3%B5%EB%B0%B0%EC%88%98 algorithm_Solving/백준/최소공배수 at main · jwc406/algorithm_Solving알고리즘 풀이 저장소입니다. Contribute to jwc406/algorithm_Solving development by creating an account on GitHub.github.com let input = require("fs").readFi.. 2024. 5. 27.
[백준] 11866번: 요세푸스 문제 0 (JavaScript, node.js) [백준] 11866번: 요세푸스 문제 0 (JavaScript, node.js) https://www.acmicpc.net/problem/11866 11866번: 요세푸스 문제 0 첫째 줄에 N과 K가 빈 칸을 사이에 두고 순서대로 주어진다. (1 ≤ K ≤ N ≤ 1,000) www.acmicpc.net const fs = require('fs'); const filePath = process.platform === 'linux' ? '/dev/stdin' : __dirname + '/input.txt'; const input = fs.readFileSync(filePath).toString().trim().split(' '); let num = []; //num 배열 생성 input.forEach((.. 2023. 6. 5.
[백준] 11279번: 최대 힙 (JavaScript, node.js) [백준] 11279번: 최대 힙 (JavaScript, node.js) https://www.acmicpc.net/problem/11279 11279번: 최대 힙 첫째 줄에 연산의 개수 N(1 ≤ N ≤ 100,000)이 주어진다. 다음 N개의 줄에는 연산에 대한 정보를 나타내는 정수 x가 주어진다. 만약 x가 자연수라면 배열에 x라는 값을 넣는(추가하는) 연산이고, x가 0 www.acmicpc.net class MaxHeap { //클래스 생성 #tree; #size; constructor() { //생성자 this.#tree = []; //힙 배열 this.#tree.push(null); //첫번째 요소 제외 this.#size = 0; } push(e){ //삽입 this.#tree.push(e).. 2023. 6. 5.
[백준] 1021번: 회전하는 큐 (JavaScript, node.js) [백준] 1021번: 회전하는 큐 (JavaScript) https://www.acmicpc.net/problem/1021 1021번: 회전하는 큐 첫째 줄에 큐의 크기 N과 뽑아내려고 하는 수의 개수 M이 주어진다. N은 50보다 작거나 같은 자연수이고, M은 N보다 작거나 같은 자연수이다. 둘째 줄에는 지민이가 뽑아내려고 하는 수의 위치가 www.acmicpc.net const fs = require('fs'); const filePath = process.platform === 'linux' ? '/dev/stdin' : __dirname + '/input.txt'; const input = fs.readFileSync(filePath).toString().split('\n'); //입력값 엔터 기.. 2023. 5. 30.