| Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|---|
| 136423 | baim. | 全排列问题 | C++ | Accepted | 100 | 166 MS | 252 KB | 431 | 2024-03-09 09:21:42 |
#include <bits/stdc++.h> using namespace std; const int N=1e2+10; const int INF=0x3f3f3f3f; int n,a[N],f[N],ans; void dfs(int x) { if(x==n) { for(int i=1;i<=x;i++) { cout<<a[i]; } cout<<endl; ans++; return; } for(int i=1;i<=n;i++) { if(f[i]==0) { f[i]=1; a[x+1]=i; dfs(x+1); f[i]=0; } a[x+1]=0; } } int main() { cin>>n; dfs(0); cout<<ans; return 0; }