728x90
import java.util.Scanner;
public class Main {
static int a;
static int[] array;
static boolean[] check;
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
a = scanner.nextInt();
scanner.close();
array = new int[a];
check = new boolean[a];
dsf(0);
}
private static void dsf(int count) {
if(count == a) {
for(int i = 0; i<a ; i++) {
System.out.print(array[i] + " ");
}
System.out.println();
}else {
for(int i = 0; i<a; i++) {
if(check[i]) continue;
else {
check[i] = true;
array[count] = i+1;
dsf(count+1);
check[i] = false;
}
}
}
}
}
728x90
'PS > BaekJoon' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
1244 Python ์ค์์น ์ผ๊ณ ๋๊ธฐ (0) | 2023.02.20 |
---|---|
1002 JAVA ํฐ๋ (0) | 2023.01.01 |
2529 JAVA ๋ถ๋ฑํธ (0) | 2022.10.27 |
10819 JAVA ์ฐจ์ด๋ฅผ ์ต๋๋ก (0) | 2022.10.26 |
1259 JAVA ํฐ๋ฆฐ๋๋กฌ์ (0) | 2022.08.31 |