hdu 1023 Train Problem II 卡特兰数+java
import java.math.BigInteger;
import java.util.Scanner;
public class Main {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner cin= new Scanner(System.in);
int n=0;
while(cin.hasNextInt())
{
n=cin.nextInt();
int i=0;
BigInteger ans=BigInteger.ONE;
for(i=1;i<=n;i++)
{
ans=ans.multiply(BigInteger.valueOf(4*i-2));
ans=ans.divide(BigInteger.valueOf(i+1));
}
System.out.println(ans);
}
}
}
版权声明:本文为博主原创文章,未经博主允许不得转载。http://xiang578.top/