首页 > 代码库 > rwkj 1423

rwkj 1423

 

 

 

#include <iostream>
#include<algorithm>
using namespace std;
int a[10];
int main(int argc, char *argv[])
{
int i;
int N;
while(cin>>N)
for(i=0;i<N;i++) a[i]=i+1;
do
{
 for(i=0;i<N;i++)
 cout<<a[i]<<" ";
 cout<<endl;
}
while(next_permutation(a,a+N)); 
 return 0;
}