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.
2 parents b8e004a + 1a4be71 commit aa4787cCopy full SHA for aa4787c
lkhyun/202601/07 BOJ G5 감소하는 수.md
@@ -0,0 +1,28 @@
1
+```java
2
+
3
+import java.util.*;
4
+import java.io.*;
5
6
+public class Main {
7
+ public static void main(String[] args) throws Exception {
8
+ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
9
+ int N = Integer.parseInt(br.readLine());
10
11
+ List<Long> list = new ArrayList<>();
12
13
+ for (int i = 1; i < 1024; i++) {
14
+ long num = 0;
15
+ for (int j = 9; j >= 0; j--) {
16
+ if ((i & (1 << j)) != 0) {
17
+ num = num * 10 + j;
18
+ }
19
20
+ list.add(num);
21
22
23
+ Collections.sort(list);
24
25
+ System.out.println(N >= list.size() ? -1 : list.get(N));
26
27
+}
28
+```
0 commit comments