I think:
AC :
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); while(n--!=0) { int a=sc.nextInt(); System.out.println(""+f(a)); } } public static int f(int a) { int [] a1=new int [22]; a1[0]=1;int b=1; for(int i=1;i<=20;i++) { a1[i]=a1[i-1]*2+b; b <<= 1; } return a1[a-1]; } }