목록ALGORITHM/BOJ (20)
오늘도 코딩하나
#1316 (그룹 단어 체커)const fs = require('fs');const file = process.platform === 'linux' ? '/dev/stdin' : __dirname+'/input.txt';const input = fs.readFileSync(file).toString().trim().split('\n').map(item => item.trim().split(' '));const gpa = {'A+':4.5, 'A0':4.0, 'B+':3.5, 'B0':3.0, 'C+':2.5, 'C0':2.0, 'D+':1.5, 'D0':1.0, 'F':0.0};let total = 0;let totalGrade = 0;for(let [subject, score, grade] of inp..
#1157 (단어 공부)solution1_Object.const fs = require('fs');const file = process.platform === 'linux' ? '/dev/stdin' : __dirname+'/input.txt';const input = fs.readFileSync(file).toString().trim().toLowerCase().split('');const result = [];input.forEach(x => { result[x] = (result[x] || 0) + 1;})const max = Math.max(...Object.values(result));const maxKey = Object.keys(result).find(x => result[x] === ..
#25083 (새싹)console.log(` ,r\'\"7r\`-_ ,' ,\/ \\. \". L_r\' \`~\\\/ | |`) #3003 (킹, 퀸, 룩, 비숍, 나이트, 폰)solution1_for().const fs = require('fs');const file = process.platform === 'linux' ? '/dev/stdin' : __dirname+'/input.txt';const input = fs.readFileSync(file).toString().trim().split(' ');const piece = [1,1,2,2,2,8];let result = [];for(let i=0; i solution2_map().const fs = r..
#2908 (상수)const fs = require('fs');const file = process.platform === 'linux' ? '/dev/stdin' : __dirname+'/input.txt';const input = fs.readFileSync(file).toString().trim().split(' ');const number = input.map(x => x.split("").reverse().join(''));console.log(Math.max(...number)); #5622 (다이얼)const fs = require('fs');const file = process.platform === 'linux' ? '/dev/stdin' : __dirname+'/input.txt';co..
#10809 (알파벳 찾기)const fs = require('fs');const file = process.platform === 'linux' ? '/dev/stdin' : __dirname+'/input.txt';const input = fs.readFileSync(file).toString().trim().split('').map(x=>x.charCodeAt());const arr = new Array(26).fill().map((x,y) => y+97);const result = arr.map(x => input.indexOf(x));console.log(result.join(' ')); # 2675 (문자열 반복)solution1_for().const fs = require('fs');cons..
#27866 (문자와 문자열)const fs = require('fs');const file = process.platform === 'linux' ? '/dev/stdin' : __dirname+'/input.txt';const [S,i] = fs.readFileSync(file).toString().trim().split('\n');console.log(S.slice(i-1,i)); #2743 (단어 길이 재기)const fs = require('fs');const file = process.platform === 'linux' ? '/dev/stdin' : __dirname+'/input.txt';const word = fs.readFileSync(file).toString().trim();cons..
#3052 (나머지)solution1_for.const fs = require('fs');const file = process.platform === 'linux' ? '/dev/stdin' : __dirname+'/input.txt';const input = fs.readFileSync(file).toString().trim().split('\n').map(Number);let arr = [];let remain = 0;for(let i=0; i solution2_new. const fs = require('fs');const file = process.platform === 'linux' ? '/dev/stdin' : __dirname+'/input.txt';const input = fs.readFi..
#10810 (공 넣기)const fs = require('fs');const file = process.platform === 'linux' ? '/dev/stdin' : __dirname+'/input.txt';const input = fs.readFileSync(file).toString().trim().split('\n');let [n,m] = input[0].split(' ').map(Number);let arr = Array(n).fill(0);for(let i=1; i #10813 (공 바꾸기)const fs = require('fs');const file = process.platform === 'linux' ? '/dev/stdin' : __dirname+'/input.txt';const..