Pages

1/19/2014

UVA 991 Safe Solutions

import java.util.Scanner;

class Main {

static public  void  main(String[] args) {
// TODO Auto-generated method stub
int [] catalan ={1,1,2,5,14,42,132,429,1430,4862,16796};;
//catalan[0] = 1;

/*for (int i =0 ; i<10; i++) {
catalan[i+1] = (catalan[i] * 2* ( 2*i +1) )/ ( i+2);
}*/
boolean flag = false;
Scanner sc = new Scanner(System.in);
while(sc.hasNext()) {
if(flag) System.out.println();
System.out.println(catalan[sc.nextInt()]);
flag = true;
}

}


}

No comments :

Post a Comment