import java.math.BigDecimal; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); while (scanner.hasNext()) { BigDecimal num1 = scanner.nextBigDecimal(); BigDecimal num2 = scanner.nextBigDecimal(); System.out.println(num1.add(num2)); } } }
[BASIC-29] 高精度加法,布布扣,bubuko.com
原文:http://blog.csdn.net/u011506951/article/details/26704163