标签:
2 2 3
12 21 123 132 213 231 312 321
#include<iostream> #include<cstdio> #include<algorithm> using namespace std; int main() { int t,n; int a[100]; scanf("%d",&t); while(t--) { scanf("%d",&n); for(int i=1;i<=n;i++) a[i]=i; sort(a+1,a+1+n); do { for(int i=1;i<=n;i++) printf("%d",a[i]); printf("\n"); }while(next_permutation(a+1,a+1+n)); } return 0; }
标签:
原文地址:http://blog.csdn.net/qq_24489717/article/details/46551781