0
点赞
收藏
分享

微信扫一扫

(计算几何8.1.3.1)UVA 10213 How Many Pieces of Land?(使用欧拉公式的应用顶点数+面数-棱数 = 2)

AbrahamW 2023-03-30 阅读 43


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


public class UVA_10213 {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		
		int t = scanner.nextInt();
		while(t > 0){
			int n = scanner.nextInt();
			
			BigInteger ans = new BigInteger(n +"").pow(4).subtract(new BigInteger(n +"").pow(3).multiply(new BigInteger(6+""))).add(new BigInteger(23+"").multiply(new BigInteger(n +"").pow(2) ).subtract(new BigInteger(18+"").multiply(new BigInteger(n +"")))).divide(new BigInteger(24+"")).add(new BigInteger(1+""));
			
			System.out.println(ans);
			
			t--;
		}
	}
}


举报

相关推荐

0 条评论