题解
2024-12-29 17:59:58
发布于:广东
12阅读
0回复
0点赞
显然结果为第 个卡特兰数.
#include <iostream>
#include <cstdio>
#define int long long
using namespace std;
int a[100005];
signed main(){
cin.tie(nullptr) -> sync_with_stdio(0);
cout.tie(nullptr) -> sync_with_stdio(0);
int n;
cin >> n;
int ans = 1;
for(int i = 1; i <= n; i++){
ans = ans * (4 * i - 2) / (i + 1);
}
cout << ans;
return 0;
}
时间复杂度:
全部评论 3
不显然
2025-02-15 来自 江西
0顶
2024-12-29 来自 广东
0顶
2024-12-29 来自 广东
0
有帮助,赞一个