ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Турниры > CEN112 Questions 2016 > задача:


15-FE-1. 50992 - Top K Obese Classes

CEN112 Questions 2016

Старт: 30.мар.2016 в 15:10:22
Финиш: 01.апр.2016 в 05:00:00
Турнир завершён!
• Турнирная таблица

Гость
• Вопросы к жюри (1)

Задачи турнира

• 15-FE-1. 50992 - Top K Obese C...
• 15-FE-2. 50993 - Products in store
• 15-FE-3. 50994 - The Most Crowded...
• 15-FE-4. 50995 - Group Average
• 15-FE-6. 50989 - Rectangles and Points
• 15-FE-7. 50990 - Two Neighbors
• 15-FE-8. 50991 - Intersecting Circles
• 15-HW-2. 50932 - Shifting rows and...
• 15-HW-3. 50933 - Sum of the Bigges...

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
Question by Ibrahim Mesecan.

Top K Obese Classes

Question: School doctor wants to start a campaign against obesity. She wants to work on top k fat classes. And, she has announced that she is going to calculate class Body Mass Indexes (BMI) and the most fit class will be awarded where

BMI = weightInKilograms / (heightInMeters * heightInMeters)
Write a program that is going to read student weight and height information from n classes and the program will define the top k classes (whose BMI is the biggest).

Input specification: First, you will be given two integers: the number of classes (n) and the number of top (k) classes to list. The following n lines will start with an integer (m) and will be followed by m pairs of numbers: an integer (weightInKilograms) and a floating point number (heightInMeters). Each pair will be followed by a semicolon where 1 ≤ n ≤ 1,000 and 1 ≤ m ≤ 60.

Output specification: Show k integers (orders of top k classes). If there are two classes with the same BMI average (if the BMI difference between two classes is smaller than 0.0001), first show the one with the smaller class ID (order of class).

Sample Input
6 3
3 54 1.74; 45 1.46; 36 1.33;
4 35 1.86; 51 1.65; 65 1.74; 57 1.99;
3 67 1.79; 44 1.32; 47 1.40;
3 58 1.33; 54 1.40; 42 1.49;
4 70 1.34; 56 1.30; 49 1.33; 48 1.32;
2 65 1.35; 38 1.88;
Sample Output
5 4 3

Explanation: There are 6 classes given, and the top 3 classes will be listed. BMI of the 3 people in the first class are: 17.84, 21.11, and 20.35. And thus the class BMI average is 19.766. The table below, lists the class BMI averages:

Class ID Class BMI
1 19.766
2 16.178
3 23.381
4 26.419
5 31.842
6 23.208



Для отправки решений необходимо выполнить вход.

www.contester.ru