Catalan数,组合数学书上有公式。
import java.math.*;
import java.io.*;
import java.util.*;
public class Main {
public static void main(String [] args){
Scanner cin = new Scanner(System.in);
BigInteger a[] = new BigInteger[101];
a[0] = BigInteger.ONE;
for(int i=1; i<=100; ++i){
a[i] = a[i-1].multiply(BigInteger.valueOf(4*i-2)).divide(BigInteger.valueOf(i+1));
}
while(cin.hasNext()){
int n= cin.nextInt();
if(n==-1) break;
System.out.println(a[n]);
}
}
}