View Code of Problem 610

#include <stdio.h>
//卡特兰数
int fun(int n) {
	if (n == 1) {
		return 1;
	}
	return fun(n - 1)*(4 * n - 2) / (n + 1);
}

int main() {
	int n;
	while (scanf("%d", &n) != EOF) {
		int res = fun(n);
		printf("%d\n", res);
	}
}

Double click to view unformatted code.


Back to problem 610