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