Competitive Programming Solutions

GitHub
back to dashboard

H. Two numbers

Codeforces - Sheet #1 (Data type - Conditions) · limit: 1s · memory: 256MB · view on codeforces

input

10 3

output

floor 10 / 3 = 3
ceil 10 / 3 = 4
round 10 / 3 = 3
Main.java
static void solve() {

        // Write your solution here
        int x = in.nextInt();
        int y = in.nextInt();

        out.println("floor "+ x + " / " + y + " = "+ (int)Math.floor((double)x/y));
        out.println("ceil "+ x + " / " + y + " = "+ (int)Math.ceil(((double)x/y)));
        out.println("round "+ x + " / " + y + " = "+ (int)Math.round(((double)x/y)));
    }