include[HTML_REMOVED]
using namespace std;
const int N = 10;
int path[N];
bool st[N];
int n;
//全排列问题
void dfs(int u){
if(u == n ){
for(int i = 0 ; i < n ; i ){
printf(“%d “,path[i]);
}
printf(“\n”);
return ;
}
for(int i = 1 ; i <= n ; i ){
if(!st[i]){
path[u]=i;
st[i]=true;
dfs(u+1);
st[i]=false;
}
}
}
int main(){
cin >> n;
dfs(0);
system(“pause”);
}