CodeChef (FCTRL2)


Question:
http://www.codechef.com/problems/FCTRL2/

Solutions:

package codechef;

import java.math.BigInteger;
import java.util.Scanner;

/**
* @author Md. Shahab Uddin
* Id : 014081002
* Dept : CTE, UIU
*/
public class FCTRL2 {

public static void main(String[] args) {

Scanner input = new Scanner (System.in);

BigInteger b [] = new BigInteger [101];

BigInteger x = BigInteger.ONE;
b [0] = BigInteger.ONE;

for ( int i = 1; i <= 100; i++ ) { b [i] = b [i - 1].multiply(x); x = x.add(b [0]); } int t = input.nextInt(); int n; while ( t-- != 0 ) { n = input.nextInt(); System.out.println (b [n]); } } } [/sourcecode]

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s