经典全排列,但是WA一半
test
code
#include <bits/stdc++.h>
using namespace std;
int n, k;
int a[10];
bool f[10];
void dfs(int step){
if (step > n){
for (int i = 1; i <= n; i++){
cout << a[i];
}cout << endl;
return ;
}
for (int i = 1; i <= n; i++){
if (f[i] == 0){
f[i] = 1;
a[step] = i;
dfs(step+1);
f[i] = 0;
}
}
}
int main(){
cin >> n >> k;
dfs(1);
return 0;
}