Title: It is easy to understand
problem -solving ideas: For the topic of the basic operation of large numbers. When the output format is uncertain, we can try it:
1) Remove the tail invalid 0
2) Remove an integer part of less than 1
code is as follows:
package com.njupt.bigInteger;
import java.math.BigDecimal;
import java.util.Scanner;
public class HDU_1753_1 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
BigDecimal a,b,c;
while(scanner.hasNext()){
a = scanner.nextBigDecimal();
b= scanner.nextBigDecimal();
c = a.add(b);
c = c.stripTrailingZeros();
String str = c.toPlainString();
if(str.startsWith("0.")){
str = str.substring(1);
}
System.out.println(str);
}
}
}