2 条题解
-
0
#include<bits/stdc++.h> using namespace std; const int N=10; int n; int path[N]; bool st[N]; void dfs(int u){ if(u == n){ for(int i=0;i<n;i++){ printf("%5d",path[i]); } cout<<endl; } for(int i=1;i<=n;i++) { if(!st[i]){ path[u] = i; st[i]=true; dfs(u+1); st[i]=false; } } } int main() { cin>>n; dfs(0); return 0; }
信息
- ID
- 320
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 6
- 标签
- 递交数
- 26
- 已通过
- 10
- 上传者