import java.util.Arrays;
import java.util.Scanner;
public class Main {
static int k;
static int si[] = new int [51];
static int arr[] = new int [101];
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner scan = new Scanner(System.in);
int i;
k = scan.nextInt();
for (i = 1; i <= k; i++) {
si[i] = scan.nextInt();
}
Arrays.sort(si, 1, k);
f(1, 1);
}
private static void f(int level, int s) {
// TODO Auto-generated method stub
int i;
if (level > 6) {
output();
return;
}
for (i = s; i <= k; i++) {
arr[level] = i;
f(level + 1, i+1);
}
}
private static void output() {
int i;
for (i = 1; i <= 6; i++) {
System.out.printf("%d ", si[arr[i]]);
}
System.out.printf("\n");
}
}
http://www.jungol.co.kr/bbs/board.php?bo_table=pbank&wr_id=2082&sca=2080
'정올문제소스코드' 카테고리의 다른 글
2567 : 싸이클 (0) | 2022.03.18 |
---|---|
1490 : 다음 조합(next combination) (0) | 2022.03.18 |
1021 : 장난감조립 (0) | 2021.12.05 |
1459 : 숫자고르기 (0) | 2021.12.05 |
1175 : 주사위 던지기2 (0) | 2021.12.05 |