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.valueOf (parament); To convert a parameter to a developed type
such as int a=3;
BigInteger b=biginteger.valueof (a);
Then b=3;
String s= "12345";
BigInteger c=biginteger.valueof (s);
Then c=12345;
2.add (); Add large integers
BigInteger a=new BigInteger ("23");
BigInteger b=new BigInteger ("34");
A. Add (b);
3.subtract (); Subtraction
4.multiply (); Multiply
5.divide (); Divide rounding
6.remainder (); Take surplus
7.pow (); A.pow (b) =a^b
8.GCD (); Greatest common divisor
9.abs (); Absolute
10.negate (); Take the inverse number
11.mod (); A.mod (b) =a%b=a.remainder (b);
12.max (); Min ();
13.punlic int Comareto ();
14.boolean equals (); is equal
15.BigInteger Constructors:
Convert. toString to String type
1 Import java.io.*; 2 Import Java.math.BigInteger; 3 Import java.util.*; 4 public class Main {5 6 public static void main (string[] args) {7//TODO auto-generated method stub 8 Scanner cin=new Scanner (New Bufferedinputstream (system.in)); 9 PrintWriter cout=new PrintWriter (system.out); int t;11 t=cin.nextint (); int eg=1;13 while (t>0), {BigInteger eight=new BigInteger ("8"); BigInteger seven=new B Iginteger ("7"); BigInteger one=new BigInteger ("1"); String inp;19 Inp=cin.next (); 2 0 BigInteger n=new BigInteger (INP) BigInteger ans;22 BigInteger ans2;23 Ans=n.multiply (n). Multiply (eight); ans2=n.multiply (seven); Ans=ans.subtract (ANS2); 26 Ans=ans.add (one), Cout.println ("Case #" +eg+ ":" +ans); ++eg;29--t;30 31 }32 Cout.flush (); 33}34 35}
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 Template