Problem C: Catalan Square
Time Limit: 1 Sec Memory Limit: 128 MB
Submit: 42 Solved: 16
[Submit][Status][Web Board]
Description
Input
Output
Sample Input
0
Sample Output
1
HINT
import java.util.*;
import java.math.*; public class Main{
BigInteger[] Cal = new BigInteger[6000];
void GetCal(){ Cal[0]=BigInteger.ONE;
Cal[1]=BigInteger.ONE; for(int i=2;i<=5100;i++)
{
BigInteger v1=BigInteger.valueOf(2*i*(2*i-1));
BigInteger v2=BigInteger.valueOf(i*(i+1));
Cal[i]=Cal[i-1].multiply(v1).divide(v2);
}
} Main()
{
Scanner in = new Scanner(System.in);
int n=in.nextInt();
GetCal();
System.out.println(Cal[n+1]);
} public static void main(String[] args) {
new Main();
}
}
/**************************************************************
Problem: 1576
User: aking2015
Language: Java
Result: Accepted
Time:476 ms
Memory:18804 kb
****************************************************************/