Problem Description
I have a very simple problem for you. Given two integers A and B, your job is to calculate the Sum of A + B.
 
Input
The first line of the input contains an integer 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.
 
Output
For each test case, you should output two lines. The 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.
 
Sample Input
2
1 2
112233445566778899 998877665544332211
 
Sample Output
Case 1:
1 + 2 = 3
 
 
Case 2:
112233445566778899 + 998877665544332211 = 1111111111111111110
 
 
 
 
import java.util.*;
import java.math.*; public class Main3 { public static void main(String[] args) {
Scanner sc=new Scanner(System.in); int t=Integer.parseInt(sc.next());
for(int i=0;i<t;i++){
BigInteger a=new BigInteger(sc.next());
BigInteger b=new BigInteger(sc.next());
BigInteger c=a.add(b);
System.out.println("Case "+(i+1)+":");
System.out.println(a+" "+"+"+" "+b+" "+"="+" "+c);
if(i!=t-1)
System.out.println();
} } }

水题 hdu1002------用BigInteger解决大数问题的更多相关文章

  1. HDU-1042-N!(Java大法好 &amp;&amp; HDU大数水题)

    N! Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others) Total Subm ...

  2. SPOJ 3693 Maximum Sum(水题,记录区间第一大和第二大数)

    #include <iostream> #include <stdio.h> #include <algorithm> #define lson rt<< ...

  3. ACM :漫漫上学路 -DP -水题

    CSU 1772 漫漫上学路 Time Limit: 1000MS   Memory Limit: 131072KB   64bit IO Format: %lld & %llu Submit ...

  4. HDU 5832 A water problem(某水题)

    p.MsoNormal { margin: 0pt; margin-bottom: .0001pt; text-align: justify; font-family: Calibri; font-s ...

  5. hdu 1018:Big Number(水题)

    Big Number Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total ...

  6. cdoj 26 遮挡判断(shadow) 水题

    遮挡判断(shadow) Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://acm.uestc.edu.cn/#/problem/show/26 ...

  7. Codeforces Round #256 (Div. 2/A)/Codeforces448A_Rewards(水题)解题报告

    对于这道水题本人觉得应该应用贪心算法来解这道题: 下面就贴出本人的代码吧: #include<cstdio> #include<iostream> using namespac ...

  8. UESTCOJ-BiliBili, ACFun… And More!(水题)

    BiliBili, ACFun… And More! Time Limit: 3000/1000MS (Java/Others)     Memory Limit: 65535/65535KB (Ja ...

  9. BZOJ USACO 银组 水题集锦

    最近刷银组刷得好欢快,好像都是水题,在这里吧他们都记录一下吧(都是水题大家一定是道道都虐的把= =)几道比较神奇的题到时再列出来单独讲一下吧= =(其实我会说是BZOJ蹦了无聊再来写的么 = =) [ ...

  10. POJ 水题(刷题)进阶

    转载请注明出处:優YoU http://blog.csdn.net/lyy289065406/article/details/6642573 部分解题报告添加新内容,除了原有的"大致题意&q ...

随机推荐

  1. jQuery EasyUI API 中文文档 - 布局(Layout)

    <html> <head> <script src="jquery-easyui/jquery.min.js"></script> ...

  2. ADN中国团队參加微软的Kinect全国大赛获得三等奖

    上周末我们团队參加了微软的Kinect全国大赛,我们的Kinect + Navisworks漫游荣膺三等奖   团队经理Joe写了篇详实的总结,我就直接转载了. http://blog.csdn.ne ...

  3. TBDR缺点

    TBDR全称Tile-based Deferred Rendering.它是Power VR独特的TBR技术的一种延伸实现手段.TBR/TBDR通过将每一帧画面划分成多个矩形区域,并对区域内的全部像素 ...

  4. [WPF]使用Pack URI路径訪问二进制资源

    一.路径格式定义 完整的URI定义为: pack://application,,,[/可选程序集名称;][可选版本;][目录名称/]文件名 缩略后的写法是: [目录名称/]文件名 二.在XAML代码中 ...

  5. angular学习(二):Controller定义总结

    上文中总结完了ng-view的应用,将运维后台分开界面到2个,进行到 逻辑Controller处理中,本文将总结一下在项目中Controller都用到了哪些知识: $scope:作用域对象,仅仅是代表 ...

  6. 事务的使用示例及WinForm实现中的若干问题

    --事务的使用示例 create database MyDB go use MyDB create table account ( Id int identity primary key, balan ...

  7. H.O.T candy

    candy是什么意思_candy在线翻译_英语_读音_用法_例句_海词词典 candy

  8. Linking Containers Together

    Linking Containers Together In the Using Docker section we touched on connecting to a service runnin ...

  9. bash,bg,bind,break,builtin,caller,compgen, complete,compopt,continue,declare,dirs,disown,enable,eval,exec,expo

    bash,bg,bind,break,builtin,caller,compgen, complete,compopt,continue,declare,dirs,disown,enable,eval ...

  10. java整合flex

    java+flex项目整合 评论0   字号:大中小 订阅 第一种:javaproject和flexproject独立 这样的方式也是非常多人使用的方式.flex程序猿和java程序猿相互独立的工作. ...