九度——题目1003:A+B
来源:互联网 发布:qq个人业务源码带后台 编辑:程序博客网 时间:2024/05/16 00:50
- 给定两个整数A和B,其表示形式是:从个位开始,每三位数用逗号","隔开。
现在请计算A+B的结果,并以正常形式输出。 - 输入:
- 输入包含多组数据数据,每组数据占一行,由两个整数A和B组成(-10^9 < A,B < 10^9)。
- 输出:
- 请计算A+B的结果,并以正常形式输出,每组数据占一行。
- 样例输入:
-234,567,890 123,456,7891,234 2,345,678
- 样例输出:
-1111111012346912
题目描述:
import java.io.BufferedInputStream;import java.math.BigInteger;import java.util.Scanner; public class Main{ /** * @param args */ public static void main(String[] args) { Scanner cin = new Scanner(new BufferedInputStream(System.in)); String inputString1 = null, inputString2 = null; String strSplit[] = null; String str1, str2; BigInteger num1 = null, num2 = null; while (cin.hasNext()) { str1 = ""; str2 = ""; inputString1 = cin.next(); inputString2 = cin.next(); strSplit = inputString1.split(","); for (int i = 0; i < strSplit.length; i++) { str1 += strSplit[i]; } num1 = new BigInteger(str1); strSplit = inputString2.split(","); for (int i = 0; i < strSplit.length; i++) { str2 += strSplit[i]; } num2 = new BigInteger(str2); System.out.println(num1.add(num2).toString()); } }} /************************************************************** Problem: 1003 User: 忆、瞻 Language: Java Result: Accepted Time:170 ms Memory:16128 kb****************************************************************/
- 九度——题目1003:A+B
- 【九度】题目1003:A+B
- 九度OJ 题目1003:A+B
- 九度OJ题目1003:A+B
- 九度online:题目1003:A+B
- 九度 题目1003:A+B
- 九度OJ 题目1003:A+B
- 九度OJ-题目1003:A+B
- 九度 题目1003:A+B
- 九度题目1003:A+B
- 九度OJ-题目1003 A+B
- 九度OJ题目1003:A+B
- 九度——题目1001:A+B for Matrices
- 九度OJ—题目1001:A+B for Matrices
- 九度OJ—题目1010:A + B
- 九度OJ—题目1015:还是A+B
- 九度OJ—题目1198:a+b(高精度计算)
- 题目 1003 A+B 九度Online Judge
- Common Functions
- 九度——题目1002:Grading
- Hoj 2485 Myacm Triangles
- ListCtrl 选中某行
- java jxl excel 数据导出 重新命名无效的工作表名称
- 九度——题目1003:A+B
- 九度——题目1004:Median
- 单点登入技术
- 通过 ulimit 改善系统性能
- (转)Android Service 服务(一)—— Service
- Sencha touch 2 store 处理超时的处理事件
- android Fragments详解:处理fragement的生命周期
- STM32学前班教程之学习过程
- spring cglib使用aop:aspectj-autoproxy的异常问题及解决