题目链接:栈
java代码:
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
int n;
Scanner in = new Scanner(System.in);
n = in.nextInt();
long arr[] = new long[n+1];
Arrays.fill(arr, 0);
arr[0] = 1;
arr[1] = 1;
for(int i=2;i<=n;++i) {
for(int j=1;j<=i;++j) {
arr[i] += arr[j-1]*arr[i-j];
}
}
System.out.println(arr[n]);
}
}