luogu#P9854. [CCC 2008 J1] Body Mass Index

[CCC 2008 J1] Body Mass Index

题目描述

The Body Mass Index (BMI) is one of the calculations used by doctors to assess an adult’s health. The doctor measures the patient’s height (in metres) and weight (in kilograms), then calculates the BMI using the formula:

$$\text{BMI} = \dfrac{\text{weight}}{\text{height} \times \text{height}} $$

Write a program which prompts for the patient’s height and weight, calculates the BMI, and displays the corresponding message from the table below.

BMI Category Message
More than 2525 Overweight
Between 18.518.5 and 25.025.0 (inclusive) Normal weight
Less than 18.518.5 Underweight

输入格式

第一行输入体重,第二行输入身高(以米为单位)。

输出格式

输出所得 BMI 值对应的信息。

题目大意

给出两个浮点数 weight(1.0weight100.0)weight(1.0 \leq weight \leq 100.0)height(1.0height2.0)height(1.0 \leq height \leq 2.0),请你帮忙判断其 BMI 值所对应的信息:

BMI 范围 对应信息
大于 2525 Overweight
介于 18.518.525.025.0 之间 Normal weight
小于 18.518.5 Underweight

BMI 计算公式:

$$\text{BMI} = \dfrac{\text{weight}}{\text{height} \times \text{height}} $$
69
1.73
Normal weight
84.5
1.8
Overweight

提示

Explanation for Output in Sample Input 1:

The BMI is 69÷(1.73×1.73)69 \div (1.73 \times 1.73), which is approximately 23.054523.0545. According to the table, this is a "Normal weight".

Explanation for Output in Sample Input 2:

The BMI is 84.5÷(1.8×1.8)84.5 \div (1.8 \times 1.8), which is approximately 26.080226.0802. According to the table, this is "Overweight".