求全排列函数
代码:
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <queue>
#define mem(p,k) memset(p,k,sizeof(p));
#define rep(i,j,k) for(int i=j; i<k; i++)
#define pb push_back
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define inf 0x6fffffff
#define ll long long
using namespace std;
const int mod=1e9+7;
int n,m,k,minn,maxx,cur,sum;
int main(){
int t,a[12];
cin>>t;
for(int i=0;i<11;i++)a[i]=i;
while(t--){
cin>>n;
do{
for(int i=1;i<=n;i++)printf("%d",a[i]);
cout<<endl;
}
while(next_permutation(a+1,a+n+1));
}
return 0;
}