题解 | #取近似值#
取近似值
https://www.nowcoder.com/practice/3ab09737afb645cc82c35d56a5ce802a
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); while (in.hasNext()) { String str = in.nextLine(); String[] strings = str.split("\\."); double update = Double.parseDouble("0."+strings[1]); if(update<0.5) System.out.println(Integer.parseInt(strings[0])); else System.out.println(Integer.parseInt(strings[0])+1); } } }