题目链接
JAVA BigInteger水过。注意输出格式就行。
<span style="font-size:18px;">import java.util.*;
import java.math.*;
public class Main {
public static void main(String args[]){
Scanner cin = new Scanner(System.in);
BigInteger ZERO = BigInteger.valueOf(0);
int N;
BigInteger temp ;
BigInteger sum =BigInteger.valueOf(0);
N = cin.nextInt();
while(N-->0)
{
sum = ZERO;
while(true){
temp = cin.nextBigInteger();
sum= sum.add(temp);
if(temp.equals(ZERO))
break;
}
System.out.println(sum);
if(N!=0)
System.out.println();
}
}
}
</span>