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--;
}
}
}
(计算几何8.1.3.1)UVA 10213 How Many Pieces of Land?(使用欧拉公式的应用顶点数+面数-棱数 = 2)
UVA_10213 Java算法解析
最新推荐文章于 2019-07-26 20:50:08 发布
本文详细解读了UVA_10213问题的Java实现过程,涉及数学运算、BigInteger类使用及算法逻辑分析。

813

被折叠的 条评论
为什么被折叠?



