题解 | #取近似值#
取近似值
https://www.nowcoder.com/practice/3ab09737afb645cc82c35d56a5ce802a
import java.util.*; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); float num = in.nextFloat(); num *= 10; int n = (int)num; if(n % 10 >= 5){ n = n/10 + 1; }else{ n /= 10;} System.out.print(n); } }