x = float(input()) #输入浮点数x y = int(x) #直接向下保留整数 z = x-y #算出小数部分值 if z >= 0.5: y += 1 #如果小鼠部分大于0.5则进位 print(y)
思路见代码中注释内容!