3 条题解
-
0徐静雨 (xujingyu) LV 8 @ 2024-6-15 10:29:58
先把表打出来:
#include <bits/stdc++.h> using namespace std; int n,cnt; void dfs(int step,int x) { if(step > n) { cnt++; return; } if(x) dfs(step,x - 1); dfs(step + 1,x + 1); return; } signed main() { for(n = 1;n <= 18;n++) { cnt = 0; dfs(1,0); printf("%d,",cnt); } return 0; }
得出答案序列:
0,1,2,5,14,42,132,429,1430,4862,16796,58786,208012,742900,2674440,9694845,35357670,129644790,477638700
然后输出。
#include <bits/stdc++.h> using namespace std; int n; int ans[19] = {0,1,2,5,14,42,132,429,1430,4862,16796,58786,208012,742900,2674440,9694845,35357670 ,129644790,477638700}; signed main() { scanf("%d",&n); printf("%d",ans[n]); return 0; }
-
02023-4-25 21:04:07@
搞笑的吧?
#include <bits/stdc++.h> using namespace std; long long n, a[20]; int main () { cin >> n; a[0] = 1, a[1] = 1; for (int i = 2; i <= n; ++i) for (int j = 0; j <= i - 1; ++j) a[i] += a[j] * a[i-1-j]; cout << a[n]; }
-
-12023-3-26 20:14:41@
要题解
- 1
信息
- ID
- 665
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 1
- 标签
- 递交数
- 37
- 已通过
- 27
- 上传者