From 2623d06d8ba24fbfbd947c6f389b044c579c1a20 Mon Sep 17 00:00:00 2001 From: Jonghwan Lee <123362165+0224LJH@users.noreply.github.com> Date: Wed, 6 Aug 2025 21:40:05 +0900 Subject: [PATCH] =?UTF-8?q?[20250806]=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=A2=85=ED=99=98?= 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" | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 "0224LJH/6 BOJ \352\260\220\354\206\214\355\225\230\353\212\224 \354\210\230.md" diff --git "a/0224LJH/6 BOJ \352\260\220\354\206\214\355\225\230\353\212\224 \354\210\230.md" "b/0224LJH/6 BOJ \352\260\220\354\206\214\355\225\230\353\212\224 \354\210\230.md" new file mode 100644 index 00000000..4e9a1667 --- /dev/null +++ "b/0224LJH/6 BOJ \352\260\220\354\206\214\355\225\230\353\212\224 \354\210\230.md" @@ -0,0 +1,52 @@ +```java +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.*; + + +public class Main { + + static int target,idx; + static long[] decreasingNum; + + + public static void main(String[] args) throws IOException { + init(); + process(); + print(); + } + + private static void init() throws IOException { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + target = Integer.parseInt(br.readLine()); + decreasingNum = new long[1000001]; + Arrays.fill(decreasingNum, -1); + idx = 0; + } + + private static void process() throws IOException { + for (int i = 1; i <= 10; i++){ + findNum(i-1,0,10); + } + + } + + private static void findNum(int curPos, long curNum,int limit) { + if (curPos == -1){ + decreasingNum[idx++] = curNum; + } + + for (int i = 0; i < limit; i++){ + long tempNum = (long) (curNum + Math.pow(10,curPos) * i); + findNum(curPos-1,tempNum,i); + + } + } + + + private static void print() { + System.out.println(decreasingNum[target]); + } +} +``` \ No newline at end of file