题解 | #取近似值#
取近似值
http://www.nowcoder.com/practice/3ab09737afb645cc82c35d56a5ce802a
n = float(input())
res = n // 1 #计算整数部分数值
tep = n - res #计算小数部分数值
#判断小数部分数值,并输出结果
if tep >= 0.5:
print(int(res + 1))
else:
print(int(res))
res = n // 1 #计算整数部分数值
tep = n - res #计算小数部分数值
#判断小数部分数值,并输出结果
if tep >= 0.5:
print(int(res + 1))
else:
print(int(res))