A+b for Input-output Practice (IV)
Time limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others)
Total submission (s): 105601 Accepted Submission (s): 55782
Problem Descriptionyour task is to Calculate the sum of some integers.
Inputinput contains multiple test cases. Each test case is contains a integer n, and then n integers follow on the same line. A test case, starting with 0 terminates, the input and this test are not processed.
Outputfor each group of the input integers you should output their sum on one line, and with one line of output for each line In input.
Sample INPUT4 1 2 3 45 1 2 3 4 50
Sample Output1015
Authorlcy
recommendjgshining | We have carefully selected several similar problems for you:1093 1094 1095 1096 1000 How to handle large number accumulation problems
ImportJava.math.BigInteger;ImportJava.util.Scanner; Public classmain{ Public Static voidMain (string[] args) {BigInteger a,b,d; String C= "0"; D=NewBigInteger (c); Scanner in=NewScanner (system.in); while(In.hasnextint ()) {b=D; intt =In.nextint (); if(T = = 0) Break; for(inti=1;i<=t;i++) {a=In.nextbiginteger (); b= A.add (b);//Note that there is a return value when using the Add Method!!! } System.out.println (b); } }}
Java hdu a+b for Input-output Practice (IV)