您的位置:首页 > 其它

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

2013-11-17 09:16 495 查看
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--;
}
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: