题目描述
Generate the complete permutation of 1..N
输入
Each input file contains only one non-negative integer N (0< N < 9)
输出
Output N! Lines, according to lexicographic order.
样例输入
3
样例输出
1 2 3
1 3 2
2 1 3
2 3 1
3 1 2
3 2 1
#include
#include
#include
#define MAX 100
using namespace std;
int used[MAX]= {0}, result[MAX];
int n;
void Prem(int step)
{
int i, j;
if(step==n)
{
for(j=0; j
>n;
Prem(0);
return 0;
}