View Code of Problem 3903

import java.util.*;
import java.math.*;
public class Main {
	public static void main(String[] args) {
		Scanner in =new Scanner(System.in);
		int t =in.nextInt();
		for(int i =0;i<t;i++) {
			int n  =in.nextInt();
			System.out.println(C0(n));
		}
	}

	public static BigInteger C0(int n) {
		BigInteger s = BigInteger.ONE;
		int a =n*2;
		int b =n-1;
		for(int i =1;i<=b;i++) {
			//System.out.println(a+" "+i);
			s=s.multiply(new BigInteger(a+"")).divide(new BigInteger(i+""));
			a--;
		}
		return s.divide(new BigInteger(n+"")).mod(new BigInteger("313091025"));
	}
}

Double click to view unformatted code.


Back to problem 3903