Integer Inquiry 校赛不会初始化0,杯具啊。 import java.math.BigInteger; import java.util.Scanner; public class Main { public static void main(String args[]) { BigInteger sum=new BigInteger("0"); BigInteger a; Scanner cin=new Scanner(System.in); int n; n=cin.nextInt(); while(cin.hasNext()) { a=cin.nextBigInteger(); if(a.equals(BigInteger.valueOf(0))==true) { System.out.println(sum); n--; if(n!=0) System.out.println(); sum=BigInteger.ZERO; continue; } sum=sum.add(a); } } }