输入两个用字符串 str 表示的整数,求它们所表示的数之和。
数据范围: 1≤len(str)≤10000
输入两个字符串。保证字符串只含有'0'~'9'字符
输出求和后的结果
输入:
9876543210 1234567890
复制输出:
11111111100
- import java.math.BigInteger;
- import java.util.*;
- /*
- * csdn:gkkk_1
- */
- public class Main {
- public static void main(String[] args) {
- Scanner in = new Scanner(System.in);
- while(in.hasNext()){
- BigInteger b1 = new BigInteger(in.next());
- BigInteger b2 = new BigInteger(in.next());
- System.out.println(b1.add(b2));
- }
- }
- }