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

5. 잃어버린 괄호

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

다윤 풀이

const filePath = process.platform === "linux" ? "/dev/stdin" : "input.txt"; let input = require("fs").readFileSync(filePath).toString().trim(); const cals = input.split("-"); let answer = 0; cals.forEach((c, index) => { const sum = c .split("+") .map(Number) .reduce((acc, cur) => acc + cur, 0); if (index == 0) answer += sum; else answer -= sum; }); console.log(answer);

민수 풀이

let n = require('fs').readFileSync("/dev/stdin").toString().trim(); let [a, ...b] = n.split('-').map(num => num.split('+').reduce((c,d) => (+c) + (+d), 0)); console.log(a - (b.reduce((a,b) => a+b, 0)));

재현 풀이

송희 풀이

승민 풀이