首页 > 编程语言 > 详细

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

时间:2017-10-07 17:04:06      阅读:263      评论:0      收藏:0      [点我收藏+]

问题描述:

技术分享

技术分享

 

 

源码:

 

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);
				
			}
		}
}

  

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

原文:http://www.cnblogs.com/forcheng/p/7634874.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!