백준 #백준 2816번 # javascript #node.js
-
[백준 / javascript] 2816번 디지털 티비알고리즘 2023. 3. 29. 15:11
https://www.acmicpc.net/problem/2816 ‘1’, ‘4’번만 이용해서 풀었다. // 2816 : 디지털 티비 const readFile = '/dev/stdin'; const [n, ...input] = require('fs') .readFileSync(readFile) .toString() .trim() .split('\\n'); let idx1 = input.indexOf('KBS1'); let idx2 = input.indexOf('KBS2'); idx2 = idx1 > idx2 ? ++idx2 : idx2; let result = ''; for (let i = 0; i < idx1; i++) { result += '1'; } for (let i = 0; i < idx1; ..