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 ...
随机推荐
- tomcat7.0安装笔记
1. 解压,新增系统环境变量CATALINA_HOME,值为tomcat所在目录,如E: tomcat7.0 PS:安装JAVA时没有配置系统变量JAVA_HOME,导致报错无法启动tomcat,新建 ...
- DRF 版本 及认证
版本控制 -- # 初始化我们的版本 version, scheme = self.determine_version(request, *args, **kwargs) request.v ...
- javascript继承之学习笔记
今天记录一下学习javascript的继承. 继承基本上是基于“类”来说的,而javascript中并不存在真正的类,所以就出现了各种模拟“类”的行为,然后就堂而皇之的使用起了类的概念.这里不谈“类” ...
- 关于oracle中varchar2与nvarchar2的一点认识
今天在oracle 10g下测试了下varchar2与nvarchar2这两种类型,网上有很多关于这两种类型的区别的帖子,我还是自己测试了下. varchar2(size type),size最大为4 ...
- StanFord ML 笔记 第五部分
1.朴素贝叶斯的多项式事件模型: 趁热打铁,直接看图理解模型的意思:具体求解可见下面大神给的例子,我这个是流程图. 在上篇笔记中,那个最基本的NB模型被称为多元伯努利事件模型(Multivariate ...
- C#分解质因数
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace app ...
- cnblogs博客申请完毕,以后再这里安家落户
cnblogs博客申请完毕,以后再这里安家落户,之前的博客就不转载了,好好搞技术,安稳过日子.
- Redis、MongoDB及Memcached的区别
Redis(内存数据库) 是一个key-value存储系统(布式内缓存,高性能的key-value数据库).和Memcached类似,它支持存储的value类型相对更多,包括string(字符串).l ...
- C#串口通讯,16进制与字符串、字节数组之间的转换。
1.将十进制数的字符串转化成十六进制数的字符串 //十进制转二进制Console.WriteLine("十进制166的二进制表示: "+Convert.ToString(166, ...
- USB之HID类Set_Report Request[调试手记1]
请翻开<Device Class Definition for Human Interface Devices (HID) Version 1.11 >7.2.2 Set_Report R ...