题解 | #取近似值#
取近似值
http://www.nowcoder.com/practice/3ab09737afb645cc82c35d56a5ce802a
全体目光向我看齐,我宣布个事儿:我是_____!
import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
double num = sc.nextDouble();
double b = num % 1;
if(b >= 0.5)
num = num - b + 1;
else
num = num - b;
System.out.println((int)num);
}
}