본문 바로가기

분류 전체보기98

[백준] 10815번 숫자 카드(JavaScript) https://www.acmicpc.net/problem/10815let input = require('fs') .readFileSync(process.platform === 'linux' ? '/dev/stdin' : './input.txt') .toString() .trim() .split('\n') .map((el) => el.split(' ').map(Number));let N = input.shift()[0];let first = input.shift().sort((a, b) => a - b);let M = input.shift()[0];let second = input.shift();let answer = [];second.forEach((el) => { let start = 0; .. 2024. 5. 4.
[백준] 1764번 듣보잡(JavaScript) https://www.acmicpc.net/problem/1764const input = require('fs') .readFileSync(process.platform === 'linux' ? '/dev/stdin' : './input.txt') .toString() .trim() .split('\n');// .map((el) => el.split(' ').map(Number));// .map(Number);const [N, M] = input.shift().split(' ').map(Number);let x = new Set(input.slice(0, N));let y = new Set(input.slice(N));let answer = [];x.forEach((el) => { if (y.h.. 2024. 5. 3.
[백준] 1049번 기타줄 (JavaScript) https://www.acmicpc.net/problem/1049const input = require('fs') .readFileSync(process.platform === 'linux' ? '/dev/stdin' : './input.txt') .toString() .trim() .split('\n') .map((el) => el.split(' ').map(Number));// .map(Number);let [N, M] = input.shift();let sort_input = input.sort((a, b) => a[0] - b[0]);let minSet = sort_input[0][0];sort_input = sort_input.sort((a, b) => a[1] - b[1]);let m.. 2024. 5. 3.
[백준] 14501번 퇴사 (JavaScript) https://www.acmicpc.net/problem/14501const input = require('fs') .readFileSync(process.platform === 'linux' ? '/dev/stdin' : './input.txt') .toString() .trim() .split('\n') .map((el) => el.split(' ').map(Number));let N = input.shift()[0];let dp = new Array(N).fill(0);for (let i = 0; i N) { // 퇴사 전 처리 할수 없는 일 continue; } dp[i] += p; // 상담 진행 했을 경우 얻는 수익 저장 for (let j = d + i; j  전형적인 .. 2024. 5. 2.