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 ...
随机推荐
- [SDOI2016]生成魔咒(后缀自动机)
/* 水题, 根据性质做就行, nq不会对答案产生贡献, 那么只算p的贡献就好了 */ #include<cstdio> #include<algorithm> #includ ...
- js控制高度自适应,做到响应式
//9宫格布局 var prints=window.innerHeight-($('.header').height()+40);//屏幕去掉(头部高度+头部padding) $('.weui-gri ...
- 微服务、SOA 和 API对比与分析
摘要: 对比微服务架构和面向服务的架构(SOA)是一个敏感的话题,常常引起激烈的争论.本文将介绍这些争论的起源,并分析如何以最佳方式解决它们.然后进一步查看这些概念如何与 API 管理概念结合使用,实 ...
- bool操作
基本类型转换的问题 bool类型没有操作. 类型转换 结论一: 想把xxx转化成yy类型. yy(xxx) 结论二: 能够表示False的数据: 0, "", [], {}, se ...
- js 数组的crud操作
增加push(); 向数组尾添加元素unshift(); 向数组头添加元素向数组指定下标添加元素:可以用Array提供的splice(); var arr = ['a','b','c']; arr.s ...
- Redis 主从复制, 读写分离
1: 是什么? 2: 经常是配置从库, 不配置主库 3.1: 每次与 master 断开之后都要从连, 除非你配置了redis.conf 3.2: 获取当前redis 服务信息 => info ...
- [转]使用STM32CubeMX:USB大容量存储设备
原文地址http://qiita.com/mt08/items/fcc925fa47726bfc6c74 概要 STM32CubeMXを使って.USB MassStorageを使ってみる. USBを使 ...
- linux 任务调度
crontab 定时任务 -e 编辑 -l 查看 -r 删除 参数 * * * * * 分钟 小时 天数 月 星期几
- centos 主机名突然变成bogon的解决方法
主机名突然变成bogon,访问网络可能会出现问题(也可能没问题,我的就没问题),可能用到主机名的服务(比如说:mysql)可能也会出现访问不了. 所以我们需要解决以下问题,本人的解决方法: 主机名 ...
- alias 设置别名
我们在使用Linux中使用较长的命令而且要经常要使用时,总是会使用别名,这里就简单的介绍一下别名alias 指令:alias设置指令的别名 语法:# alias name='command line ...