有用java写的大佬吗!!

B2016 浮点数向零舍入

StephenCurry3O @ 2021-11-21 12:58:37

public class B2016 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        float x = sc.nextFloat();
        int a;
        a = (int) Math.floor(x);
        System.out.println(a);
    }
}

by lime_ @ 2021-11-24 12:34:57

把 float x = sc.nextFloat(); 给成 double r1 = scanner.nextDouble(); int a改成long a; a = (int) Math.floor(x) 改成 a = (long) Math.floor(x);


by StephenCurry3O @ 2021-11-30 16:00:47

@lime_ 感谢


|