题解 | #取近似值#
取近似值
http://www.nowcoder.com/practice/3ab09737afb645cc82c35d56a5ce802a
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
String str = scan.nextLine();
double val = Double.valueOf("0." + str.split("\\.")[1]);
int sign;
if (val >= 0.5) {
sign = 1;
} else {
sign = 0;
}
System.out.println(Integer.valueOf(str.split("\\.")[0]) + sign);
}
}