P5714 [Shenji 3. Example 7] Obesity Problem
Description
The BMI index is an international standard commonly used to measure whether a person is underweight or overweight. It is calculated as $\dfrac{m}{h^2}$, where $m$ is the weight (in kilograms) and $h$ is the height (in meters). The ranges and results are as follows:
- Less than $18.5$: underweight, output `Underweight`;
- Greater than or equal to $18.5$ and less than $24$: normal weight, output `Normal`;
- Greater than or equal to $24$: overweight. You must output the BMI value first (using the default precision of `cout`), then output a newline, and then output `Overweight`.
Given the weight and height, you need to determine the body type based on the BMI index and output the corresponding result.
For non-C++ languages, when outputting, please round to six **significant digits**. If the decimal part has trailing $0$'s, do not output those trailing $0$'s.
Note that keeping six **significant digits** is not the same as keeping six decimal places. For example, $123.4567$ should be output as $123.457$, and $5432.10$ should be output as $5432.1$.
Input Format
A single line.
The first line contains $2$ floating-point numbers $m, h$, representing the weight (in kg) and the height (in m), respectively.
Output Format
Output one string on one line, representing the BMI-based result. In particular, for the special handling of the `Overweight` case, refer to the statement above.
Explanation/Hint
Constraints: For all data, $40 \le m \le 120$, $1.4 \le h \le 2.0$. There are at most three digits after the decimal point in $m$ and $h$.
Translated by ChatGPT 5