1.1 2.9 1.1111111111 2.3444323343 1 1.1
4 3.4555434454 2.1
import java.math.BigDecimal; import java.util.Scanner; public class yugtg { public static void main(String[] args) { Scanner cin = new Scanner(System.in); BigDecimal a,b,s; while(cin.hasNext()) { a = cin.nextBigDecimal(); b = cin.nextBigDecimal(); s = a.add(b); String sum = s.stripTrailingZeros().toPlainString(); System.out.println(sum); } } }
HDUJ 1753 大明A+B,布布扣,bubuko.com
原文:http://blog.csdn.net/hyccfy/article/details/38233389