G32 卡特兰数
视频链接:https://www.bilibili.com/video/BV1td4y1F7v1/
#include <iostream> using namespace std; int n; long long f[20]; int main(){ cin >> n; f[0] = 1; for(int i = 1; i <= n; i++) f[i] = f[i-1]*(4*i-2)/(i+1); cout << f[n] << endl; return 0; }
视频链接:https://www.bilibili.com/video/BV1td4y1F7v1/
#include <iostream> using namespace std; int n; long long f[20]; int main(){ cin >> n; f[0] = 1; for(int i = 1; i <= n; i++) f[i] = f[i-1]*(4*i-2)/(i+1); cout << f[n] << endl; return 0; }