PB-Distribution of BMI Levels
PB-Distribution of BMI Levels
Problem Description
A patient’s BMI value is equal to 𝑊/𝐻 2 where W is patient’s weight in kilogram and H is
patient’s height in meter. If 10 ≤ W ≤ 250 and 0.8 ≤ H ≤ 2.4, a patient’s weight and height
data are valid. The BMI levels are presented in the table below. You will be given a number of
data sets, each of which consists of a person’s weight and height. Find out the BMI levels that
have the largest number of data sets being classified into those levels. You have to skip invalid
data sets.
Input Format
The first line contains only an integer specifying the number of test cases. Each test case takes a
number of lines. Each pair of numbers form a data set where weight comes first. The input for
each test case ends if either a zero weight or a zero height is read. A patient’s height is in meter
and a patient’s weight is in Kg.
Output Format
The output for a test case takes a line which shows the names of the BMI levels that have the
largest number of data sets being classified into those levels. The level names should be printed
Online Midterm: Fundamental Computer Programming- C++ Lab(I), Rung-Bin Lin
Nov.. 20, 2021, International Bachelor Program in Informatics, Yuan Ze University
in order of increasing BMI values. Level names are separated by at least one whitespace
character. After the level names, it follows the largest number just mentioned. Each output line
should start with a # and then a space character follows.
Example