View Code of Problem 610

import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner in =new Scanner(System.in);
		while(in.hasNext()) {
			long n  =in.nextInt();
			System.out.println(C(n*2,n-1)/n);
		}
	}
	public static long C(long a,long b) {
		long s =1;
		for(int i =1;i<=b;i++) {
			s=s*(a--)/i;
		}
		return s;
	}
}

Double click to view unformatted code.


Back to problem 610