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 ...
随机推荐
- flask基础知识
关于flask框架的基础知识 相关基础知识:定义路由,定义参数,获取参数,重定向 简单易懂 ---hello.py # -*- coding: utf-8 -*- # Flask hello worl ...
- Linux TCP/IP调优-Linux内核参数注释
固定文件的内核参数 下列文件所在目录: /proc/sys/net/ipv4/ 名称 默认值 建议值 描述 tcpsyn_retries 5 1 对于一个新建连接,内核要发送多少个SYN连接请求才决定 ...
- python开发学习(元组、字符串、列表、字典深入)
https://www.cnblogs.com/songqingbo/p/5129116.html(转载学习)
- kafka源代码环境配置
kafka版本10.0.0.没有采用最新版本是因为项目中目前使用了这个版本. 1.安装gradle 首先进入https://gradle.org/install 查看Install manually- ...
- 转:JSON 获取属性值的方法
JSON(JavaScript Object Notation) 是一种轻量级的数据交换格式.易于人阅读和编写.同时也易于机器解析和生成.它基于JavaScript(Standard ECMA-262 ...
- Ruby学习笔记1 -- 基本语法和数据类型, Class
Ruby 有4种数据类型:String, Boolen, Array, Hashes Ruby 有3种操作方法:Method, attribute, ?? Ruby 有xxx: Classes, Ob ...
- system.data oracleClient 需要Oracle客户端8.1.7或high
- python学习笔记_week18
note 1.JS 正则 test - 判断字符串是否符合规定的正则 rep = /\d+/; rep.test("asdfoiklfasdf89asdfasdf") # true ...
- Http协议基础知识
r equest POST https://re.csdn.net/csdnbi HTTP/1.1方法 url/uri 协议的版本号 1.1Host: re.csdn.netConnection: k ...
- django 模板context的理解
context作为view与template之间的桥梁,理解它的工作原理对于djagno的模板工作机制至关重要. class ContextDict(dict):#上下文词典,由词典可以通过conte ...