题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=1047
import java.math.BigInteger;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scn = new Scanner(System.in);
int casesNumber = scn.nextInt();
for (int cases = 1; cases <= casesNumber; ++cases) {
if (1 != cases) {
System.out.println();
}
BigInteger result = BigInteger.ZERO;
while (scn.hasNext()) {
BigInteger number = scn.nextBigInteger();
if (number.equals(BigInteger.ZERO)) {
break;
}
result = result.add(number);
}
System.out.println(result);
}
scn.close();
}
}