Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
139284 mairuisheng 单词接龙 C++ 输出超限 0 0 MS 248 KB 426 2024-03-22 22:55:39

Tests(0/5):


#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; }


测评信息: