Today to more than a large number of Java brush, to fight for the easy water after the large number of problems ~
HDU 1002 Large number Add Link: http://acm.hdu.edu.cn/showproblem.php?pid=1002
Code
Import Java.util.*;import Java.math.biginteger;public class main{public static void Main (string[] args) { Scanner in=new Scanner (system.in); int N=in.nextint (); for (int i=1;i<=n;i++) { BigInteger a,b,c; A=in.nextbiginteger (); B=in.nextbiginteger (); C=a.add (b); if (i!=1) System.out.println (); SYSTEM.OUT.PRINTLN ("Case" +i+ ":"); System.out.println (A + "+" +b+ "=" +c);}}}
HDU 1042 Large number of factorial links: http://acm.hdu.edu.cn/showproblem.php?pid=1042
Code
Import Java.util.*;import Java.math.biginteger;public class main{public static void Main (string[] args) { Scanner in=new Scanner (system.in); int A; while (In.hasnext ()) { a=in.nextint (); BigInteger Ans=biginteger.one; for (int i=1;i<=a;i++) { ans=ans.multiply (biginteger.valueof (i)); } System.out.println (ANS);}}
HDU 1133 The application of the number of Rand Links: http://acm.hdu.edu.cn/showproblem.php?pid=1133
Code
Mport Java.util.*;import Java.math.biginteger;public class main{public static void Main (string[] args) { int A, b; Scanner in=new Scanner (system.in); int cnt=0; while (In.hasnext ()) { cnt++; A=in.nextint (); B=in.nextint (); BigInteger Ans=biginteger.one; if (a==0&&b==0) break; if (a<b) Ans=biginteger.zero; else {for (int i=1;i<=a+b;i++) { ans=ans.multiply (biginteger.valueof (i)); } int mpl= (a-b+1); int dvd= (a+1); Ans=ans.multiply (biginteger.valueof (MPL)); Ans=ans.divide (biginteger.valueof (DVD)); } System.out.println ("Test #" +cnt+ ":"); System.out.println (ANS);}}
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Java large number practice first play