题解 | #高精度整数加法#

高精度整数加法

http://www.nowcoder.com/practice/49e772ab08994a96980f9618892e55b6

主要是记一下

import java.math.BigInteger;
import java.util.*;
/*
输入两个用字符串 str 表示的整数,求它们所表示的数之和。
输入两个字符串。保证字符串只含有'0'~'9'字符
* */
public class Main{
    public static void main(String[] args){
        Scanner sc = new  Scanner(System.in);
        BigInteger b1 = new BigInteger(sc.nextLine());
        BigInteger b2 = new BigInteger(sc.nextLine());
        System.out.println(b1.add(b2));
    }
}
全部评论
我想知道这样能不能得分..
1 回复 分享
发布于 2023-10-17 22:48 广东
就离谱哈哈哈哈哈
1 回复 分享
发布于 2022-11-21 16:32 上海

相关推荐

评论
14
4
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务