From 2c7de6a96be4ce0a73d81befec54093a6d029507 Mon Sep 17 00:00:00 2001 From: LiiNi-coder <97495437+LiiNi-coder@users.noreply.github.com> Date: Sun, 5 Oct 2025 23:55:21 +0900 Subject: [PATCH] =?UTF-8?q?[20251005]=20BOJ=20/=20G5=20/=20=EA=B0=90?= =?UTF-8?q?=EC=86=8C=ED=95=98=EB=8A=94=20=EC=88=98=20/=20=EC=9D=B4?= =?UTF-8?q?=EC=9D=B8=ED=9D=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...4\355\225\230\353\212\224 \354\210\230.md" | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 "LiiNi-coder/202510/05 BOJ \352\260\220\354\206\214\355\225\230\353\212\224 \354\210\230.md" diff --git "a/LiiNi-coder/202510/05 BOJ \352\260\220\354\206\214\355\225\230\353\212\224 \354\210\230.md" "b/LiiNi-coder/202510/05 BOJ \352\260\220\354\206\214\355\225\230\353\212\224 \354\210\230.md" new file mode 100644 index 00000000..5b42e529 --- /dev/null +++ "b/LiiNi-coder/202510/05 BOJ \352\260\220\354\206\214\355\225\230\353\212\224 \354\210\230.md" @@ -0,0 +1,36 @@ +```java +import java.io.*; +import java.util.*; + +public class Main { + static List list = new ArrayList<>(); + + public static void main(String[] args) throws IOException { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + int n = Integer.parseInt(br.readLine()); + + for(int i = 0; i < 10; i++){ + dfs(i, 1); + } + + Collections.sort(list); + // for(long l: list){ + // System.out.print(l + ", "); + // } + if(n >= list.size()){ + System.out.println(-1); + }else{ + System.out.println(list.get(n)); + } + } + + static void dfs(long num, int depth){ + list.add(num); + long last = num % 10; + for(int next = 0; next < last; next++){ + dfs(num * 10 + next, depth + 1); + } + } +} + +```