조합문제
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
|
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;
public class Main6603_로또 {
private static int K;
private static int[] lotto;
private static ArrayList<Integer> list;
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
while(true) {
StringTokenizer st = new StringTokenizer(br.readLine(), " ");
K = Integer.parseInt(st.nextToken());
if(K==0) {
break;
}
list = new ArrayList<>();
lotto = new int[K];
for (int i = 0; i < K; i++) {
lotto[i] = Integer.parseInt(st.nextToken());
}
comb(0, 0);
System.out.println();
}
}// end of main
public static void comb(int idx, int k) {
if (idx == 6) {
}
System.out.println();
return;
}
for (int i = k; i < lotto.length; i++) {
list.add(lotto[i]);
comb(idx + 1, i + 1);
}
}
}// end of class
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4f; text-decoration:none">Colored by Color Scripter
|
http://colorscripter.com/info#e" target="_blank" style="text-decoration:none; color:white">cs |
'Algorithm 문제풀이' 카테고리의 다른 글
[BOJ] 백준 9205 - 맥주마시면서걸어가기 (JAVA) (0) | 2019.04.28 |
---|---|
[BOJ] 백준 1759 - 암호만들기 (JAVA) (0) | 2019.04.28 |
[BOJ] 백준 2178 - 미로탐색 (JAVA) (0) | 2019.04.27 |
백준1987 알파벳 (1) | 2019.04.11 |
백준2573 빙산 (4) | 2019.04.09 |