JAVA睑板....

Integer Inquiry

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 12042    Accepted Submission(s): 3037

Problem Description
One of the first users of BIT's new supercomputer was Chip Diller. He extended his exploration of powers of 3 to go from 0 to 333 and he explored taking various sums of those numbers. 
``This supercomputer is great,'' remarked Chip. ``I only wish Timothy were here to see these results.'' (Chip moved to a new apartment, once one became available on the third floor of the Lemon Sky apartments on Third Street.) 
Input
The input will consist of at most 100 lines of text, each of which contains a single VeryLongInteger. Each VeryLongInteger will be 100 or fewer characters in length, and will only contain digits (no VeryLongInteger will be negative).

The final input line will contain a single zero on a line by itself.

Output
Your program should output the sum of the VeryLongIntegers given in the input.

This problem contains multiple test cases!

The first line of a multiple input is an integer N, then a blank line followed by N input blocks. Each input block is in the format indicated in the problem description. There is a blank line between input blocks.

The output format consists of N output blocks. There is a blank line between output blocks.

Sample Input
1 123456789012345678901234567890 123456789012345678901234567890 123456789012345678901234567890 0
Sample Output
370370367037037036703703703670
Source
East Central North America 1996
import java.util.*;
import java.math.*;public class Main
{public static void main(String[] args){Scanner cin= new Scanner(System.in);int n=cin.nextInt();boolean flag=false;while(n-->0){if(flag==false) flag=true;else System.out.println("");BigInteger ans=BigInteger.ZERO;while(cin.hasNextBigInteger()){BigInteger m=cin.nextBigInteger();if(m.equals(BigInteger.ZERO))break;ans=ans.add(m);}System.out.println(ans);}}
}

版权声明:本文博客原创文章,博客,未经同意,不得转载。

HDOJ 1047 Integer Inquiry相关推荐

  1. hdu 1047 Integer Inquiry

    题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=1047 Integer Inquiry Description One of the first use ...

  2. HDU 1047 Integer Inquiry( 高精度加法水 )

    链接:传送门 思路:高精度水题 /*************************************************************************> File ...

  3. Poj 1503 Integer Inquiry

    1.链接地址: http://poj.org/problem?id=1503 2.题目: Integer Inquiry Time Limit: 1000MS   Memory Limit: 1000 ...

  4. ZOJ 1292 Integer Inquiry

    https://zoj.pintia.cn/problem-sets/91827364500/problems/91827364791 题意:先输入一个数  表示测试样例的个数,接着输入几个数(可以不 ...

  5. Integer Inquiry

    java大数加法 import java.io.*; import java.math.*; import java.util.*;public class Main {public static v ...

  6. 杭电OJ分类题目(1)

    原题出处:HDOJ Problem Index by Type,http://acm.hdu.edu.cn/typeclass.php 杭电OJ分类题目(1) HDU Introduction HDU ...

  7. Java Java Java

    学下java 的大数该怎么用>< hdu 1023 Train Problem II 求 卡特兰 数 诶...不记得卡特兰数的我眼泪掉下来 第一次用 java 大数 有点激动...> ...

  8. POJ题目分类(按初级\中级\高级等分类,有助于大家根据个人情况学习)

    本文来自:http://www.cppblog.com/snowshine09/archive/2011/08/02/152272.spx 多版本的POJ分类 流传最广的一种分类: 初期: 一.基本算 ...

  9. 题目梳理(一)(2019.07.06~2019.07.20)

    一.字典树类型 A   HihoCoder1014 Trie树(已做) 题目链接    https://hihocoder.com/problemset/problem/1014 B    HDU12 ...

最新文章

  1. 【TUP第11期】腾讯黄朝兴:浅谈客户端架构
  2. Apache服务器部署ASP.NET网站
  3. 关于Servlet和异步Servlet
  4. fatal: Could not read from remote repository.的解决办法
  5. 最短哈密尔顿圈matlab解法_复杂制造过程最优哈密尔顿圈算法的MATLAB仿真与分析.doc...
  6. cam350 不能打开光绘文件_CAM350使用教程-复制Gerber层
  7. 金三银四Java面试的一些感受,实战篇
  8. [湖南集训] 谈笑风生
  9. phpstorm 新加入项目的文件--全局搜索不到 ctrl + shift + R
  10. 钉钉日志范文100篇_钉钉工作日记(模板一)
  11. 英语知识系列:单词中元音字母发音规律
  12. VINS-MONO边缘化策略
  13. Linux centOS系统备份还原(dd+rsync方式)
  14. 《数字图像处理》冈萨雷斯版 读书笔记(二)
  15. Typora自定义样式--你值得拥有自己的styles
  16. jQuery取消checkbox选中状态
  17. unity打包安卓(anroid)APK及安卓环境设置
  18. org.apache.poi.ss.usermodel.Cell.getCellType()Lorg/apache/poi/ss/usermodel/CellType(百分比解决你问题)
  19. Docker容器学习笔记一
  20. MySQL数据库使用小皮系统(phpstudy)的安装及配置流程

热门文章

  1. linux默认的https端口,如何在Ubuntu 18.04 Bionic Beaver Linux上拒绝除HTTP端口80和HTTPS端口443之外的所有传入端口...
  2. 简单的python画图代码_python opencv如何实现简易画图板 python opencv实现简易画图板代码...
  3. android是语言吗,android – 内容描述应该是多种语言吗?
  4. 虚拟机随服务器启动,VMware Server中虚拟机随宿主机自动启动
  5. 怎么将翼型导入catia_CATIA导入翼型出现了问题,翼型是在网上找的。说是样条线运算有问题 - 机械 - 小木虫 - 学术 科研 互动社区...
  6. java socket 线程池_java socket编程的一个例子(线程池)
  7. 360 php offer,审批终于通过了,从面试到拿到奇虎360的offer已经失…
  8. Windows下设置自动关机的命令指示符
  9. 不妨问问自己,学习C语言是为了什么?
  10. 中国剩余定理证明过程