A+b for Input-output Practice (III)
Time limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others)
Total submission (s): 113961 Accepted Submission (s): 60127
Problem Descriptionyour task is to Calculate A + B.
Inputinput contains multiple test cases. Each test case contains a pair of integers a and B, one pair of integers per line. A test case containing 0 0 terminates the-input and this-test case are not-to-be processed.
Outputfor each pair of input integers A and B are should output the sum of a and B in one line, and with one line of OUTPU T for each line in input.
Sample INPUT1 510 200 0
Sample Output630
Authorlcy
It is worth noting how to judge whether a large number is equal to a number, and how to convert a number to a large number form, note that a large number is essentially a string
ImportJava.math.BigInteger;ImportJava.util.Scanner; Public classMain//Note the Java format when you brush a question{ Public Static voidMain (string[] args) {BigInteger a,b,d; String C= "0"; D=NewBigInteger (c);//Convert c to large number form, save with DScanner in =NewScanner (system.in); while(In.hasnextbiginteger ()) {a=In.nextbiginteger (); b=In.nextbiginteger (); if(A.compareto (d) = = 0 && B.compareto (d) = = 0)//Note that a large number of methods are used to determine whether the two large numbers are equal Break; System.out.println (A.add (b)); } }}
Java HDU a+b for Input-output Practice (III)