Files
python/TangDou/CSP-J/AcWingTraining/T6/415.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

20 lines
452 B
C++

#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 40;
LL c[N][N];
int main() {
// 预处理组合数
for (int i = 0; i < N; i++)
for (int j = 0; j <= i; j++)
if (!j)
c[i][j] = 1;
else
c[i][j] = c[i - 1][j - 1] + c[i - 1][j];
int n;
cin >> n;
// 卡特兰数
cout << c[n * 2][n] / (n + 1) << endl;
return 0;
}