#include <stdio.h>
#include <stdlib.h>
int number[20], len, temp;
void output(){
int i;
printf("\n");
for(i=0; i<len; ++i)
printf("%d ", number[i]);
}
int pailie(int n){
int ii;
if(n==len)
output( );
for(ii=n; ii<len; ++ii) {
temp = number[ii]; number[ii] = number[n]; number[n] = temp;
pailie(n+1);
temp = number[ii]; number[ii] = number[n]; number[n] = temp;
}
return 0;
}
int main(int argc, char *argv[]){
int index = 0;
scanf("%d", &len);
while(index<len)
scanf("%d", &number[index++]);
pailie(0);
system("PAUSE");
return 0;
}
算法设计与分析n次全排列源代码下载如图片无法显示或论文不完整,请联系qq752018766