首页 > 其他 > 详细

51nod 1005 大数加法

时间:2017-08-05 20:53:51      阅读:158      评论:0      收藏:0      [点我收藏+]
 
基准时间限制:1 秒 空间限制:131072 KB 分值: 0 难度:基础题
 
Input
第1行:大数A
第2行:大数B
(A,B的长度 <= 10000 需注意:A B有可能为负数)
 
Output
输出A + B
 
Input示例
68932147586
468711654886
 
Output示例
537643802472

Java在处理大数据方面很具有优势~~~~~~~~~~~~~~~~~~~

import java.math.BigInteger;
import java.util.Scanner;

public class Demo01 {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		BigInteger integer = new BigInteger(scanner.nextLine().trim());
		BigInteger integer2 = new BigInteger(scanner.nextLine().trim());
		integer = integer.add(integer2);
		System.out.print(integer);
	}
}

  

 

51nod 1005 大数加法

原文:http://www.cnblogs.com/z-712/p/7291306.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!