Baekjoon
-
문제 번호 : 1181번 문제 바로가기 ☞ https://www.acmicpc.net/problem/1181 const fs = require('fs'); const filePath = process.platform === 'linux' ? '/dev/stdin' : './input.txt'; let input = fs.readFileSync(filePath).toString().trim().split('\r\n'); input.shift(); let arr = [...new Set(input)].sort((a, b) => a.length - b.length || a.localeCompare(b)); console.log(arr.join('\n')); [배운 점] - 고민 끝에 답을 찾아보았는데, loc..
[BaekJoon] 1181 번 단어 정렬 문제 - (nodejs)문제 번호 : 1181번 문제 바로가기 ☞ https://www.acmicpc.net/problem/1181 const fs = require('fs'); const filePath = process.platform === 'linux' ? '/dev/stdin' : './input.txt'; let input = fs.readFileSync(filePath).toString().trim().split('\r\n'); input.shift(); let arr = [...new Set(input)].sort((a, b) => a.length - b.length || a.localeCompare(b)); console.log(arr.join('\n')); [배운 점] - 고민 끝에 답을 찾아보았는데, loc..
2022.01.04 -
문제 번호 : 1475번 문제 바로가기 ☞ https://www.acmicpc.net/problem/1475 const fs = require('fs'); const filePath = process.platform === 'linux' ? '/dev/stdin' : './input.txt'; let input = fs.readFileSync(filePath).toString(); let array = new Array(10).fill(0); for(let i of input){ array[i] += 1; } array[6] = (array[6]+array[9])%2 === 0 ? (array[6]+array[9])/2 : Math.floor((array[6]+array[9])/2) + 1; array[..
[BaekJoon] 1475 번 방 번호 문제 - (nodejs)문제 번호 : 1475번 문제 바로가기 ☞ https://www.acmicpc.net/problem/1475 const fs = require('fs'); const filePath = process.platform === 'linux' ? '/dev/stdin' : './input.txt'; let input = fs.readFileSync(filePath).toString(); let array = new Array(10).fill(0); for(let i of input){ array[i] += 1; } array[6] = (array[6]+array[9])%2 === 0 ? (array[6]+array[9])/2 : Math.floor((array[6]+array[9])/2) + 1; array[..
2022.01.04 -
문제 번호 : 2210번 문제 바로가기 ☞ https://www.acmicpc.net/problem/2210 const fs = require('fs'); const filePath = process.platform === 'linux' ? '/dev/stdin' : './input.txt'; let input = fs.readFileSync(filePath).toString().trim().split('\r\n'); // 표준입력 테스트를 위해 이렇게 했지만 제출을 위해서는 // split('\r\n') 에서 \r은 제거하고 제출해야합니다. const tables = input.map(el=> el.split(' ')); let visited = Array.from(Array(tables.length)..
[BaekJoon] 2210 번 숫자판 점프 문제 - (nodejs)문제 번호 : 2210번 문제 바로가기 ☞ https://www.acmicpc.net/problem/2210 const fs = require('fs'); const filePath = process.platform === 'linux' ? '/dev/stdin' : './input.txt'; let input = fs.readFileSync(filePath).toString().trim().split('\r\n'); // 표준입력 테스트를 위해 이렇게 했지만 제출을 위해서는 // split('\r\n') 에서 \r은 제거하고 제출해야합니다. const tables = input.map(el=> el.split(' ')); let visited = Array.from(Array(tables.length)..
2022.01.03 -
문제 번호 : 15649 문제 바로가기 ☞ https://www.acmicpc.net/problem/15649 const fs = require('fs'); const filePath = process.platform === 'linux' ? '/dev/stdin' : './input.txt'; let input = fs.readFileSync(filePath).toString().trim().split('\n'); const NM = input[0].split(' '); let visited = new Array(Number(NM[0])).fill(0); let arr = []; dfs(0); function dfs(count/*재귀횟수*/){ if(count === Number(NM[1])){ con..
[BaekJoon] 15649 번 N과 M (1) 문제 - (nodejs)문제 번호 : 15649 문제 바로가기 ☞ https://www.acmicpc.net/problem/15649 const fs = require('fs'); const filePath = process.platform === 'linux' ? '/dev/stdin' : './input.txt'; let input = fs.readFileSync(filePath).toString().trim().split('\n'); const NM = input[0].split(' '); let visited = new Array(Number(NM[0])).fill(0); let arr = []; dfs(0); function dfs(count/*재귀횟수*/){ if(count === Number(NM[1])){ con..
2022.01.01 -
문제 번호 : 1018 문제 바로가기 ☞ https://www.acmicpc.net/problem/1018 const fs = require('fs'); let input = fs.readFileSync('/dev/stdin').toString().trim().split('\n'); const first_inputs = input[0].split(' '); const chess = []; for(let i=0; i
[BaekJoon] 1018 번 체스판 다시 칠하기 문제 - (nodejs)문제 번호 : 1018 문제 바로가기 ☞ https://www.acmicpc.net/problem/1018 const fs = require('fs'); let input = fs.readFileSync('/dev/stdin').toString().trim().split('\n'); const first_inputs = input[0].split(' '); const chess = []; for(let i=0; i
2022.01.01 -
문제 번호 : 2739번 문제 바로가기 ☞ https://www.acmicpc.net/problem/2739 const fs = require('fs'); const filePath = process.platform === 'linux' ? '/dev/stdin' : './input.txt'; let input = fs.readFileSync(filePath).toString(); // 입력 값이 하나일 땐 split을 사용하지 말 것 solution(Number(input)); function solution(A){ let a = A; for(let i=1;i
[BaekJoon] 2739 번 구구단 문제 - (nodejs)문제 번호 : 2739번 문제 바로가기 ☞ https://www.acmicpc.net/problem/2739 const fs = require('fs'); const filePath = process.platform === 'linux' ? '/dev/stdin' : './input.txt'; let input = fs.readFileSync(filePath).toString(); // 입력 값이 하나일 땐 split을 사용하지 말 것 solution(Number(input)); function solution(A){ let a = A; for(let i=1;i
2021.12.28