标签:string bsp pre ems turn class cst str code
#include<iostream> #include<cstring> using namespace std; const int maxn=1e3; int vis[maxn]; int p[maxn]; int n; int t=0; void dfs(int x) { if(x==n+1) { for(int i=1;i<=n;i++) cout<<p[i]<<" "; cout<<endl; return ; } for(int i=1;i<=n;i++) { if(!vis[i]) { vis[i]=1; p[x]=i; dfs(x+1); vis[i]=0; } } } int main() { while(cin>>n) { memset(vis,0,sizeof(vis)); dfs(1); } }
标签:string bsp pre ems turn class cst str code
原文地址:https://www.cnblogs.com/liyexin/p/12680850.html