- 1005 计算并联电阻的阻值
- 2019-07-02 10:04:56 @
使用round(num,2)时AC但使用print("%.2f"%rb)时却WA。而round(num,2)并不是严格保留两位小数的,这是否说明题目要求并非严格保留两位小数?
1 条评论
-
nightprowler LV 7 @ 2019-07-02 19:16:50
确实有问题,而且Python3中round()函数也并非严格地四舍五入。相关规定是"Values are rounded to the closest multiple of 10 to the power minus ndigits; if two multiples are equally close, rounding is done toward the even choice."(来源https://www.runoob.com/w3cnote/python-round-func-note.html)
- 1
信息
- 难度
- 2
- 分类
- (无)
- 标签
- (无)
- 递交数
- 1636
- 已通过
- 965
- 通过率
- 59%
- 被复制
- 1
- 上传者