您的位置:首页 > 编程语言 > Python开发

51 Nod 1005 大数加法【Java大数乱搞,python大数乱搞】

2017-07-25 17:55 471 查看
1005 大数加法


基准时间限制:1 秒 空间限制:131072 KB 分值: 0 难度:基础题

给出2个大整数A,B,计算A+B的结果。

Input
第1行:大数A
第2行:大数B
(A,B的长度 <= 10000 需注意:A B有可能为负数)

Output
输出A + B

Input示例
68932147586
468711654886

Output示例
537643802472


题目链接:http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1005
分析:学了简单的Java,就来体验了一波Java的爽感,Java大法真的好啊!
下面给出AC代码:

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

public class sss {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner in=new Scanner(System.in);
BigInteger  a,b;
a=in.nextBigInteger();
b=in.nextBigInteger();
System.out.println(a.add(b));
}
}


python大法更简单啊!三行代码解决一切问题!

下面给出python3 AC代码:

a=int(input())
b=int(input())
print(a+b)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: