HD-ACM算法专攻系列(12)——Integer Inquiry

问题描述:

 

 

源码:

 

import java.math.BigInteger;
import java.util.*;

public class Main
{
		//主函数
        public static void main(String[] args)
        {
            int n;
			BigInteger a, result, zero = BigInteger.valueOf(0);
			Scanner cin = new Scanner(System.in);
			n = cin.nextInt();
			for(int i = 0; i < n; i++)
			{
				if(i > 0)System.out.println();
				result = BigInteger.valueOf(0);
				while(true)
				{
					a = cin.nextBigInteger();
					if(a.equals(zero))break;
					result = result.add(a);
				}
				System.out.println(result);
				
			}
		}
}

  

posted @ 2017-10-07 15:37  OneForCheng  阅读(148)  评论(0编辑  收藏  举报