HomeAboutMeBlogGuest
© 2025 Sejin Cha. All rights reserved.
Built with Next.js, deployed on Vercel
🤎
프론트엔드 데브코스 5기 교육생
/
🐥
김은수팀
/
🏆
17주차 : 기업 코테 딱대
/
3. 통계학

3. 통계학

고른사람
재현
URL
https://www.acmicpc.net/problem/2108
난이도
실버3

민수 풀이

let input = require('fs').readFileSync("/dev/stdin").toString().trim().split("\n").map(e => parseInt(e)); input.shift(); input = input.sort((a,b) => a - b); // 산술평균 console.log(parseInt(Math.round(input.reduce((a,b) => a + b) / input.length))) // 중앙값 console.log(input[Math.floor(input.length/2)]) // 최빈값 let obj = {}; input.forEach(e => obj[e] == undefined ? obj[e] = 1 : obj[e] += 1 ); let max = Math.max(...Object.values(obj)); let maxList = []; for(const [key, value] of Object.entries(obj)){ if(value == max)maxList.push(parseInt(key)); } maxList.sort((a,b) => a - b); console.log(maxList.length > 1 ? maxList[1] : maxList[0]); // 범위 console.log(input[input.length -1 ] - input[0]);

재현 풀이

송희 풀이

승민 풀이