# 유형 : 탐색, DFS
# dfs 쉬운 문제중 하나, 인덱스만 잘 설정해서 탐색돌리면 해결가능
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
package bj;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;
public class p6603_ {
static int arr[];
static int cnt=0;
static int N;
static boolean visit[];
static ArrayList<Integer> arrList = new ArrayList<>();
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
N = Integer.parseInt(st.nextToken());
while(N!=0) {
arr = new int[N];
visit = new boolean[N];
for(int i=0; i<N; i++)
arr[i] = Integer.parseInt(st.nextToken());
for(int i=0; i<N; i++) {
arrList.add(arr[i]);
dfs(i);
}
st = new StringTokenizer(br.readLine());
N = Integer.parseInt(st.nextToken());
System.out.println();
}
}
public static void dfs(int index) {
System.out.println();
return;
}
for(int i=index+1; i<N; i++) {
arrList.add(arr[i]);
dfs(i);
}
}
}
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4ftext-decoration:none">Colored by Color Scripter
|
http://colorscripter.com/info#e" target="_blank" style="text-decoration:none;color:white">cs |
'백준' 카테고리의 다른 글
#백준_1019 책 페이지 - Java (0) | 2020.01.29 |
---|---|
#백준_2143 두 배열의 합 - Java (0) | 2020.01.28 |
#백준_1987 알파벳 - Java (0) | 2020.01.27 |
#백준_14002 가장 긴증가하는 부분 수열 4 - Java (0) | 2020.01.26 |
#백준_12738 가장 긴 증가하는 부분 수열 3 - Java (0) | 2020.01.26 |