题解 | #取近似值#

取近似值

http://www.nowcoder.com/practice/3ab09737afb645cc82c35d56a5ce802a

import java.util.Scanner;
public class Main{
    public static void main(String []args){
        Scanner in = new Scanner(System.in);
        float num = in.nextFloat();
        if(num - (float)((int) num) < (float)0.5){
            System.out.print((int)num);
        }
        else{
            System.out.print((int)num + 1);
        }
    }
}
全部评论

相关推荐

lvonge:佬是什么时候的offer ,我收到了offer但是还没有收到礼盒邮件
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
正在热议
更多
牛客网
牛客企业服务