标签:splay long clu std int sam size pen 字典
3
1 2 3
1 3 2
2 1 3
2 3 1
3 1 2
3 2 1
#include <bits/stdc++.h> using namespace std; #define ll long long int a[20]; void print(int n,int ans) { int i,j,k; if(ans==n) { for(i=0; i<n-1; i++) printf("%d ",a[i]); printf("%d\n",a[n-1]); return; } else for(i=1; i<=n; i++) { k=1; for(j=0; j<ans; j++) if(a[j]==i) k=0; if(k) { a[ans]=i; print(n,ans+1); } } } int main() { memset(a,0,sizeof(a)); int i,j,k,n; scanf("%d",&n); print(n,0); return 0; }
标签:splay long clu std int sam size pen 字典
原文地址:https://www.cnblogs.com/nublity/p/9291897.html