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 2119d52 commit 60eb82cCopy full SHA for 60eb82c
src/backjoon/_15652.java
@@ -14,13 +14,28 @@ public class _15652 {
14
public static void main(String[] args) throws IOException {
15
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
16
StringTokenizer st = new StringTokenizer(br.readLine());
17
- // memory 111924 runtime 372
+ // memory 13464 runtime 92
18
N = Integer.parseInt(st.nextToken());
19
M = Integer.parseInt(st.nextToken());
20
+ arr = new int[M];
21
+ dfs(1,0);
22
+ System.out.println(sb);
23
+ }
24
25
+ static void dfs(int current, int depth){
26
27
+ if(depth == M){
28
+ for(int v : arr){
29
+ sb.append(v).append(" ");
30
31
+ sb.append("\n");
32
+ return;
33
34
-
35
+ for(int i=current; i<=N; i++){
36
+ arr[depth] = i;
37
+ dfs(i, depth+1);
38
39
}
40
41
/*
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments