高精度_百炼_浮点数加法 2738 (Python)

1 from decimal import Decimal,getcontext
2 getcontext().prec=101#设置浮点数的精度为101位
3 a=Decimal(input())
4 b=Decimal(input())
5 print(str(a+b).rstrip('0'))#去掉右边多余的0

 

posted @ 2018-02-02 10:14  MapReduce  阅读(355)  评论(0编辑  收藏  举报