HDU 1047
View Code
1 import java.util.*; 2 import java.math.*; 3 import java.io.*; 4 5 public class Hdu1047{提交时要改为Main 6 public static void main(String args[]){ 7 int n, flag=0; 8 BigInteger a, sum; 9 10 Scanner cin = new Scanner (System.in); 11 n = cin.nextInt(); 12 13 for(int i=0; i<n; i++){ 14 if(flag==1) 15 System.out.println(); 16 flag = 1; 17 18 sum = BigInteger.ZERO; 19 while(cin.hasNext()){ 20 21 a = cin.nextBigInteger(); 22 if(a.intValue() == 0) 23 break; 24 sum = sum.add(a); 25 } 26 27 System.out.println(sum); 28 } 29 } 30 }