Jayden`s
[JS] 2231
const fs = require('fs'); const { stringify } = require('querystring'); const path = process.platform === 'linux' ? '/dev/stdin' : './data.txt'; let input = fs.readFileSync(path).toString().trim(); function solve(input) { let N = parseInt(input); let answer = []; for (let i = 0; i parseI..
[JS] 2798
const fs = require('fs'); const path = process.platform === 'linux' ? '/dev/stdin' : './data.txt'; const input = fs.readFileSync(path).toString().trim().split('\n'); function solve(input) { const [N, M] = input[0].split(' ').map((x) => parseInt(x)); const cardNums = input[1].split(' ').map((x) => parseInt(x)); const answer = new Array(); for (let i of cardNums) { for (let j of cardNums) { for (l..
220607(ํ) ํด์ง์ฐ๊ธ ๋ํดํธ์ต์
๋ค์๋ฌ๋ถํฐ ํด์ง์ฐ๊ธ ๋ํดํธ์ต์ ๋์ ๊ฐ๋จํ ๋งํ๋ฉด ํด์ง์ฐ๊ธ์ DBํ, DCํ์ผ๋ก ์ ํํ ์ ์๋๋ฐ, DCํ์ ์ฐ๊ธ์ ๋ณธ์ธ์ด ์ํ๋ ํ๋ ๋ฐ ํฌ์์ ํ์ฉํ ์ ์๋ ํํ์ด๋ค. ๋ค๋ง, DCํ์ผ๋ก ๊ฐ์ ํด๋๊ณ ํน์ ์ํ์ ๋ํ ์ง์๋ฅผ ํ์ง ์์ ํ์ฉ๋์ง ๋ชปํ๋ ํด์ง์ฐ๊ธ๋ค์ด ๋ง์๋ค. ์ด์ ์ด๋ฅผ ํ์ฉํ๊ธฐ ์ํด ๋ํดํธ์ต์ ์ ๊ฑธ์ด๋์ด ๊ทผ๋ก์๊ฐ ์ฌ์ ์ ์ ํ ์ํ์ผ๋ก ์ฆ๊ถ์ฌ๊ฐ ์ด์ฉํ๋๋กํ๋ ๊ฒ์ด๋ค. ์ ํ์ฉ๋ง ๋๋ค๋ฉด ๊ทผ๋ก์๋, ์ฆ๊ถ์ฌ๋ ์์ํ ์ ์๋ ์ ๋๊ฐ ๋ ๊ฒ ๊ฐ๋ค.
[JS] ํด์ - ์์ฃผํ์ง ๋ชปํ ์ ์
function solution(participant, completion) { let answer; participant.sort(); completion.sort(); for (let i = 0; i < participant.length; i++) { if (participant[i] !== completion[i]) { answer = participant[i]; break; } } return answer; } // ํด์ ๋ฌธ์ ๋ผ๋ ์ ์ ๊ฐ์ํ์ ๋, ์ข์ ํ์ด function solution(participant, completion) { const map = new Map(); for(let i = 0; i < participant.length; i++) { let a = participant[..
[JS]์์ ํ์-๋ชจ์๊ณ ์ฌ
function solution(answers) { const lengthAns = answers.length; const first = [1, 2, 3, 4, 5]; const second = [2, 1, 2, 3, 2, 4, 2, 5]; const third = [3, 3, 1, 1, 2, 2, 4, 4, 5, 5]; const firstAns = new Array(Math.ceil(lengthAns / first.length)) .fill(first) .flat(); const secondAns = new Array(Math.ceil(lengthAns / second.length)) .fill(second) .flat(); const thirdAns = new Array(Math.ceil(lengt..