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

4. 듣보잡

문제 선택자
송희
URL
https://www.acmicpc.net/problem/1764
난이도
실버4
 

정다윤 풀이

김민수 풀이

하송희 풀이

안재현 풀이

이승민 풀이

const filePath = process.platform === "linux" ? "/dev/stdin" : "input.txt"; const input = require("fs") .readFileSync(filePath) .toString() .trim() .split("\n"); const [heard, seen] = input[0].split(" ").map(Number); const heardSet = new Set(input.slice(1, heard + 1)); const seenSet = new Set(input.slice(heard + 1)); const intersection = new Set([...heardSet].filter((x) => seenSet.has(x))); const ans = [...intersection].sort((a, b) => a.localeCompare(b)).join("\n"); console.log(intersection.size + "\n" + ans);
const [nArr, ...arr] = require('fs').readFileSync("/dev/stdin").toString().trim().split("\n"); let obj = {}; arr.forEach(e => obj[e] = (obj[e] || 0) + 1); let double = Object.keys(obj).filter(e => obj[e] > 1); console.log(double.length+'\n'+double.sort().join('\n'));
const fs = require("fs"); const filePath = process.platform === "linux" ? "/dev/stdin" : "./input.txt"; let input = fs.readFileSync(filePath).toString().trim().split("\n"); const [n, m] = input.splice(0, 1).join("").split(" "); const notHear = new Set(input.splice(0, +n)); let notSee = new Set(input); let notHearAndSee = []; notSee.forEach((item) => { if (notHear.has(item)) notHearAndSee.push(item); }); console.log(notHearAndSee.length + "\n" + notHearAndSee.sort().join("\n"));
let fs = require('fs'); //const inputs = fs.readFileSync('/dev/stdin').toString().trim().split('\n'); const inputs = fs.readFileSync(__dirname+'/ex2.txt').toString().split('\n'); const nm = inputs[0].split(' '); const n = Number(nm[0]); const m = Number(nm[1]); const nSet = new Set(); const mSet = new Set(); for (let i=1; i<inputs.length; i++) { if (i < n+1) { nSet.add(inputs[i]); } else { mSet.add(inputs[i]); } } const r = [...nSet].filter(item => mSet.has(item)).sort(); console.log(r.length); console.log(r.join('\n'));