题解 | #取近似值#

取近似值

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))
全部评论
学习5天了 只要这段代码看懂了
4 回复 分享
发布于 2022-06-22 19:12

相关推荐

每晚夜里独自颤抖:1600一个月?
点赞 评论 收藏
分享
评论
47
10
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务