Solution for CCC '08 J1 - Body Mass Index in Java 8


Nov. 5, 2019 0.911626 seconds Java 8
import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) {
Scanner in = new Scanner(System.in);
        float a = in.nextFloat();
        float b = in.nextFloat();
        b = a / (b * b);
        
        if(b < 18.5){
            System.out.println("Underweight");
        } else if(b >= 18.5 && b <= 25){
            System.out.println("Normal weight");
        } else{
            System.out.println("Overweight");
        }

    }
}

Editorial


No editorial for this problem. :(

Original Problem


You can view the original page for this problem on the DMOJ.