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 ...
随机推荐
- openstack cpu pinning
为了减少CPU竞争,提高CPU cache命中率,可以把guest的vcpu pin到host的物理CPU上. 在openstack中,可以添加以下到flavor extra specs: hw:cp ...
- 微服务、SOA 和 API对比与分析
摘要: 对比微服务架构和面向服务的架构(SOA)是一个敏感的话题,常常引起激烈的争论.本文将介绍这些争论的起源,并分析如何以最佳方式解决它们.然后进一步查看这些概念如何与 API 管理概念结合使用,实 ...
- [java,2017-12-01] 播放音频文件
废话不多说,直接上代码 jar包 <!-- 2017-12-01音频播放jar包 --> <dependency> <groupId>javazoom</gr ...
- HDU1847 Good Luck in CET-4 Everybody 博弈 SG函数
题意:给定n张牌,两个人轮流摸牌,每次摸牌张数为2的幂次,问先手胜还是后手胜 n≤1000 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1847 # ...
- 大小端,memcpy和构造函数
问题:memcpy一段内存到std::bitset里,bitset里的内存数据和被拷贝的内存数据对应不上 代码如下: #include <iostream> #include <bi ...
- 部署django项目,sqlite3数据库出错sqlite3.NotSupportedError: URIs not supported
如果遇到这个错误 sqlite3.NotSupportedError: URIs not supported 修改类似 该路径 的 base.py文件 /root/.virtualenvs/fkPy3 ...
- SaltStack 和 Ansible 的简单比较
https://blog.csdn.net/nqxqxq/article/details/76154847 https://www.cnblogs.com/lgeng/p/6567424.html ...
- 写一个小demo过程中遇到的各种问题 学生管理考勤系统(网页模拟)
添加与新增一些小玩意的1.0.3版本:传送门 各位带哥,这不是你们要的c++.java.c#作业哈 课上要求做个小作业,学生管理考勤系统,原本想着是个练手的好机会,结果只证实了我还是个弟中弟. 设想的 ...
- js中json字符串与对象的转换及是否为空
1.json对象(数组)转字符串 var b=[ { "CategoryName" : "Beverages", "ProductName" ...
- 登录之md5加密
语句: password = hex_md5(password); 引入js文件: md5.js: /* * A JavaScript implementation of the RSA Data S ...