Http://acm.hdu.edu.cn/showproblem.php? Pid = 3547 yesterday's competition question; cube vertex dyeing question this question is cube vertex dyeing, part of the polya count: there is a formula for direct set, (k ^ 8 & #43; 17 * k ^ 4 & #43; 6 * k ^ 2)/24; where k represents the face http://acm.hdu.edu.cn/showproblem.php? Pid = 3547 yesterday's competition question; cube vertex dyeing problem
This is part of the vertex coloring of the cube, polya counting: there is a formula to set directly, (k ^ 8 + 17 * k ^ 4 + 6 * k ^ 2)/24; k indicates the number of colors. because the question is high precision, it is obvious that Java can be used. However, nbutOJ does not support direct ORZ... Then we started the sad reminder of wa ,,,,
import java.util.*;import java.math.*;import java.lang.*;public class Main {/** * @param args */public static void main(String[] args) {// TODO Auto-generated method stub Scanner cin=new Scanner(System.in); int t=cin.nextInt();for(int i=1;i<=t;i++) { BigDecimal a=cin.nextBigDecimal(),b=BigDecimal.valueOf(24),c,d=BigDecimal.valueOf(17); c=(a.pow(8).add(d.multiply(a.pow(4))).add(BigDecimal.valueOf(6).multiply(a.pow(2)))).divide(b); String str=c.toPlainString(); // System.out.println("C==="+c+" "+"str=="+str); System.out.print("Case "+i+": "); if(str.length()>15) { for(int j=str.length()-15;j