Can find the law, the title of the approximate meaning is to find the number of different spanning tree of the given graph
Can find an answer of N from 1 to 10 o'clock
1 5 16 45 121 320 841 2205 5776 15125
Rule is
Set odd[] as the square root of odd items
Then odd[i] = Odd[i-1]*3-odd[i-2]; (i>=3)
The number of even items divided by 5 can also get the above rule.
At last, run with high precision.
C + + basic is within 10ms, Java 880ms ....
1 ImportJava.io.*;2 ImportJava.util.*;3 Importjava.math.*;4 classMain5 {6 Public Static voidMain (String args[]) {7Scanner cin =NewScanner (system.in);8 intn =cin.nextint ();9BigInteger odd[] =Newbiginteger[105];TenBigInteger even[] =Newbiginteger[105]; OneODD[1] = even[1] =Biginteger.one; AODD[2] =NewBigInteger ("4"); -EVEN[2] =NewBigInteger ("3"); - for(inti = 3;i<=51;++i) theOdd[i] = odd[i-1].multiply (even[2]). Subtract (odd[i-2]); - for(inti = 3;i<=51;++i) -Even[i] = even[i-1].multiply (even[2]). Subtract (even[i-2]); - if(n%2==1) System.out.println (odd[(n+1)/2].multiply (odd[(n+1)/2])); + ElseSystem.out.println (Even[n/2].multiply (EVEN[N/2]). Multiply (NewBigInteger ("5"))); - } +}
BZOJ1002 [FJOI2007] rotavirus