hdu 1047(java)
1 import java.io.*; 2 import java.text.*; 3 import java.math.*; 4 import java.util.*; 5 public class Main { 6 7 /** 8 * @param args 9 */ 10 public static void main(String[] args) { 11 // TODO 自动生成的方法存根 12 Scanner cin = new Scanner(new BufferedInputStream(System.in)); 13 int n; 14 BigInteger a,ans; 15 n = cin.nextInt(); 16 for(int i=1;i<=n;i++){ 17 ans = BigInteger.valueOf(0); 18 while(true){ 19 a = cin.nextBigInteger(); 20 if(a.compareTo(BigInteger.ZERO)==0) 21 break; 22 ans = ans.add(a); 23 } 24 if(i!=1) 25 System.out.println(); 26 System.out.println(ans); 27 } 28 } 29 } 30