These days to do a few words with a large number of questions, found that Java to larger number of operations is very convenient. It's very practical for acmer.
1 ImportJava.io.*;2 ImportJava.math.BigInteger;3 ImportJava.util.*;4 Public classMain {5 6 Public Static voidMain (string[] args) {7 //TODO auto-generated Method Stub8Scanner cin=NewScanner (NewBufferedinputstream (system.in));9PrintWriter cout=NewPrintWriter (System.out);Ten intT; Onet=cin.nextint (); A intEg=1; - while(t>0) - { theBigInteger eight=NewBigInteger ("8"); -BigInteger seven=NewBigInteger ("7"); -BigInteger one=NewBigInteger ("1"); - String INP; +inp=Cin.next (); -BigInteger n=NewBigInteger (INP); + BigInteger ans; A BigInteger ans2; atans=n.multiply (n). Multiply (eight); -Ans2=N.multiply (seven); -ans=ans.subtract (ANS2); -ans=Ans.add (one); -Cout.println ("Case #" +eg+ ":" +ans); -++eg; in--T; - to } + Cout.flush (); - } the *}
All calculations of a large number are made between large numbers
BIgInteger A, B;
A=a.add (b);
A=a.substract (b);
A=a.multiply (b);
A=a.divied (b);
A=A.GCD (b);
Java Large number calculation