View Code of Problem 3902

import java.util.*;
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();
			long a=2;
			for(int j =0;j<n;j++) {
				a=(long) Math.pow(2,a);
			}
			System.out.println(a%1000000007);
			//System.out.println(AM(n));
		}
	}
	public static long AM(int n ) {
		if(n==1) {
			return 4;
		}else {
			return  (long)Math.pow(2, AM(n-1))%1000000007;
		}
	}
}

Double click to view unformatted code.


Back to problem 3902