或者直接打卡特兰数的表应该也行
by Alexxu2024 @ 2024-04-22 19:13:29
你可以试试,很期待你的成果~
by World_Scientology @ 2024-04-22 19:14:14
应该可以的,
by Zoe_888 @ 2024-04-22 19:16:30
这道题没必要那样吧……
```cpp
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int f[20][20];
int dfs(int i,int j){
if(f[i][j])return f[i][j];
if(i==0)return f[i][j]=1;
if(j==0)return f[i][j]=dfs(i-1,j+1);
return f[i][j]=dfs(i-1,j+1)+dfs(i,j-1);
}
int n;
int main() {
cin>>n;
cout<<dfs(n,0)<<endl;
return 0;
}
```
by World_Scientology @ 2024-04-22 19:22:07