题解 | #取近似值#
取近似值
https://www.nowcoder.com/practice/3ab09737afb645cc82c35d56a5ce802a
import decimal
b=float(input())
res=b//1
if decimal.Decimal(b)-decimal.Decimal(res)<0.5:
print(int(res))
else:
print(int(res+1))
取近似值
https://www.nowcoder.com/practice/3ab09737afb645cc82c35d56a5ce802a
import decimal
b=float(input())
res=b//1
if decimal.Decimal(b)-decimal.Decimal(res)<0.5:
print(int(res))
else:
print(int(res+1))
相关推荐