hdu1002-A + B Problem II-(java大数)
A + B Problem II
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 460526 Accepted Submission(s):
89173
integers A and B, your job is to calculate the Sum of A + B.
T(1<=T<=20) which means the number of test cases. Then T lines follow,
each line consists of two positive integers, A and B. Notice that the integers
are very large, that means you should not process them by using 32-bit integer.
You may assume the length of each integer will not exceed 1000.
first line is "Case #:", # means the number of the test case. The second line is
the an equation "A + B = Sum", Sum means the result of A + B. Note there are
some spaces int the equation. Output a blank line between two test
cases.
1 2
112233445566778899 998877665544332211
1 + 2 = 3
Case 2:
112233445566778899 + 998877665544332211 = 1111111111111111110
import java.math.BigInteger;//操作大型整数
import java.math.BigDecimal;//操作大型小数
import java.util.Scanner;
import java.util.Arrays;
public class Main//hdu1002
{
public static void main(String []args)
{
BigInteger a,b,sum;
Scanner scan=new Scanner(System.in);
int t;
t=scan.nextInt();
for(int i=1;i<=t;i++)
{
a=scan.nextBigInteger();
b=scan.nextBigInteger();
sum=a.add(b);
System.out.println("Case "+i+":");
System.out.println(a+" + "+b+" = "+sum);
if(i!=t)
System.out.println();
}
}
}
hdu1002-A + B Problem II-(java大数)的更多相关文章
- hdu1002 A + B Problem II(大数题)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1002 A + B Problem II Time Limit: 2000/1000 MS (Java/ ...
- HDU1002 -A + B Problem II(大数a+b)
A + B Problem II Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) ...
- HDU1002 A + B Problem II 大数问题
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1002 A + B Problem II Time Limit: 2000/1000 MS (Java ...
- A + B Problem II(大数加法)
http://acm.hdu.edu.cn/showproblem.php?pid=1002 A + B Problem II Time Limit: 2000/1000 MS (Java/Other ...
- HDU 1023 Train Problem II (大数卡特兰数)
Train Problem II Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) ...
- HPU 1002 A + B Problem II【大数】
A + B Problem II Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) ...
- hdoj 1002 A + B Problem II【大数加法】
A + B Problem II Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) ...
- HDU 1002:A + B Problem II(大数相加)
A + B Problem II Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) ...
- hdu1002 A + B Problem II(高精度加法) 2016-05-19 12:00 106人阅读 评论(0) 收藏
A + B Problem II Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) ...
- nyoj 103-A+B Problem II (python 大数相加)
103-A+B Problem II 内存限制:64MB 时间限制:3000ms 特判: No 通过数:10 提交数:45 难度:3 题目描述: I have a very simple proble ...
随机推荐
- Java 8- Java 分支结构 - if…else/switch
Java 分支结构 - if...else/switch 顺序结构只能顺序执行,不能进行判断和选择,因此需要分支结构. Java有两种分支结构: if语句 switch语句 if语句 一个if语句包含 ...
- hive创建orc表,使用LLAP查询
create table if not exists test_orc( name string, age int, address string ) partitioned by (dt strin ...
- Java之ConcurrentHashMap
由于工作中使用到了ConcurrentHashMap,然后查了一波资料,最后整理如下: 1. 描述: ConcurrentHashMap是在Java1.5作为HashTable的替代选择新引入的,是c ...
- 16.Mongodb安装
Mongodb是由c++编写的非关系型数据库,是一个基于分布式文件存储的开源数据库系统,其内容存储形式类似JSON对象,它的字段值可以包含其他文档.数组及文档数组,非常灵活. 1.相关链接: http ...
- openx
1openx 插件开发——终端用 2openx _金额 3openx ————带整理 4openx url 5Openx 2.8.x 在php5.4.x下数据统计不能正常显示解决方案 6openx改造 ...
- git 简单的操作命令
1, 克隆已存在项目 => git clone url 2, 拉取代码 => git pull 3, 配置账号密码 git config --global user.email &quo ...
- linux指令tar笔记
tar 工具常用选项如表所列. 选项 说明 -c 创建存档文件,与-x相斥 -t 列出档案文件的文件列表 -x 解包存档文件,与-c相斥 -A 合并存档文件 -d 比较存档文件与源文件 - ...
- js 在光标位置插入内容
原文:https://blog.csdn.net/smartsmile2012/article/details/53642082 createDocumentFragment()用法: https:/ ...
- 一种去中心化的manager设计思路
通常,我们设计游戏引擎时,或者管理器时,都会由管理器产出各种产品,一旦有新产品要加,就要修改管理器,来增加相应的生成代码. 这从设计上来看有两个问题: 1,管理器参数需要有个类型,在管理器中用if e ...
- 一小段测试atof的代码
#include <stdio.h> //#include <stdlib.h> double a=0; int main(int argc, char *argv[]) { ...