hdu 1002 A + B Problem II(Java)
来源:互联网 发布:mac安装win10格式化 编辑:程序博客网 时间:2024/05/22 07:01
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.
代码
import java.math.BigInteger;import java.util.Scanner;public class Main{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int t = 0; boolean isFrist = true; while(t++<n){ BigInteger a = sc.nextBigInteger(); BigInteger b = sc.nextBigInteger(); BigInteger c = a.add(b); if(!isFrist){ System.out.println(); }else{ isFrist=!isFrist; } System.out.println("Case "+t+":"); System.out.println(a.toString()+" + "+b.toString()+" = "+c.toString()); } }}
- hdu 1002 A + B Problem II(java)
- hdu 1002 A + B Problem II(Java)
- 【HDU 1002 A + B Problem II】+ JAVA
- HDU 1002 A+B Problem II JAVA
- hdu - 1002 - A + B Problem II(Java大数)
- hdu 1002 A + B Problem II ( JAVA大数)
- HDU-1002 A + B Problem II Java大数
- hdu 1002 A + B Problem II(Java大数)
- hdu 1002A + B Problem II(java)
- HDU 1002 A + B Problem II (JAVA大数)
- HDU 1002 A + B Problem II -- java大法好
- HDU-1002-A + B Problem II [大数运算 | java语言]
- HDU 1002 A + B Problem II
- HDU 1002A + B Problem II
- HDU 1002 - A + B Problem II
- HDU 1002 A + B Problem II
- HDU 1002 A + B Problem II
- HDU 1002 A + B Problem II
- busybox移植及ubuntu常用命令
- 字符串加密
- UVA 10118 dfs
- [分布式系统]-分布式消息系统:Kafka
- 115 城市平乱【dijkstra】
- hdu 1002 A + B Problem II(Java)
- tomcat 之startup.bat文件
- java parseInt和valueof的区别
- 今天学习了正则表达式
- Python学习----面向对象高级编程
- 当页面完全加载完成后执行一个js函数
- jQuery中 wrap() wrapAll() 与 wrapInner()的区别
- C++封装mysql的基本API
- My TaskList