You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
452 B
20 lines
452 B
#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;
|
|
} |