| Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|---|
| 361084 | 黄浙峰老师 | 【C6-7】全排列 | C++ | Time Limit Exceeded | 0 | 1000 MS | 256 KB | 417 | 2025-11-15 13:20:48 |
#include<bits/stdc++.h> using namespace std; int n; int p[10]; bool a[10]; void hsg(int x){ if(x==n){ for(int i=0;i<n;i++){ cout<<p[i]<<" "; } cout<<endl; return ; } for(int i=1;i<=n;i++){ if(!a[i]){ a[i]=true; p[x]=i; //枚举位置上数字的可能性 hsg(x+1); //下一层 a[i]=false; //恢复现场 } } } int main(){ cin>>n; hsg(0); return 0; }