백준 1174 nodejs

윤익·2022년 10월 28일
0

https://www.acmicpc.net/problem/1174

const fs = require('fs')
const input = fs.readFileSync('/dev/stdin').toString().trim().split('\n')

const N = +input[0]
const num = Array.from({length: 10}, (_, i) => i.toString())
for (const e of num)
  for (let i = 0; i < +e % 10; i++) num.push(e + i.toString())
const output = num.length > N - 1 ? num[N - 1] : -1
console.log(output)
profile
https://nickyoon.tistory.com/ 기술 블로그 이전

0개의 댓글