题解 | #实现四舍五入#

实现四舍五入

http://www.nowcoder.com/practice/020a0cf673174d5795d97ae79cff59a0

using namespace std;

int main() {

    double d;
    cin >> d;

    // write your code here......
    cout << (d > 0 ? ((d - static_cast<int>(d)) > (static_cast<int>(d) + 1 - d) ? static_cast<int>(d) + 1  :static_cast<int>(d)) 
             : ((d - static_cast<int>(d)) < (static_cast<int>(d) - 1 - d) ? static_cast<int>(d) - 1  :static_cast<int>(d)));

    return 0;
}
全部评论

相关推荐

03-05 17:03
已编辑
浙江工商大学 C++
陈好好wy:整体看下来有点空空的感觉,可以把每一段项目经历都再完善一下,然后用小标题的形式写个两到三条,目前看有点太简单了,不太能看出具体在这个项目里做了什么工作。还是要尽量把自己做的工作以量化的形式体现在简历上呢。
双非本科求职如何逆袭
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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