NYOJ 45 棋盘覆盖

棋盘覆盖


水题,题不难,找公式难

import java.math.BigInteger;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner input=new Scanner(System.in);
		int n=input.nextInt();
		while(n-->0){
			int k =input.nextInt();	
			System.out.println(BigInteger.valueOf(4).pow(k).subtract(BigInteger.ONE).divide(BigInteger.valueOf(3)));
		}
	}
}


 

你可能感兴趣的:(覆盖)