We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e802424 commit ae75582Copy full SHA for ae75582
week12/BOJ_1038(감소하는 수).java
@@ -0,0 +1,30 @@
1
+import java.io.*;
2
+import java.util.*;
3
+
4
+public class Main {
5
6
+ private static int N;
7
+ private static int count = 0;
8
9
+ public static void main(String[] args) throws IOException {
10
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
11
+ N = Integer.parseInt(br.readLine());
12
+ dfs(0, 11);
13
+ System.out.println("-1");
14
+ }
15
16
+ public static void dfs(long num, int index) {
17
+ if(index == 0) {
18
+ if(count == N) {
19
+ System.out.println(num);
20
+ System.exit(0);
21
22
+ count++;
23
+ return;
24
25
+ long k = (num == 0) ? 10 : num % 10;
26
+ for(long i=0; i<k; i++) {
27
+ dfs(num*10 + i, index-1);
28
29
30
+}
0 commit comments