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

Разделы > Linear Data Structures: Arrays > задача:


51126 - Dr. Fllanxha

Задачи раздела

• 50420 - Teachers Sightseeing
• 50977 - Gaussian Elimination
• 50395 - Page "Like" Averages
• 50516 - Lines
• 50446 - Snake
• 50345 - Orders
• 51127 - Maze solver
• 50822 - Linked List
• 51126 - Dr. Fllanxha
• 50529 - Row to Table
• 50499 - Table to Row
• 50823 - Secret Number
• 50853 - Parking Place
• 50990 - Two Neighbors
• 50496 - Falling Bricks
• 51021 - Number of Nodes
• 50829 - Decode an Image

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

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

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

Dr. Fllanxha

Dr. Fllanxha opposes Dr. Li for the complexity of Tiae words. Dr. Fllanxha says:

"According to the formula that Dr. Li used: 'Ra', 'Sara', 'Desara' and 'Katerina' have all the same difficulty. However, Katerina should have a larger difficulty value compared to Sara or others due to the number of letters used.".

He defines the difficulty of a word using the vowels (a, e, i, o, and u).

For example: the word "Ra" has 1 vowel and 2 letters and its TV is 4; the word "Sara" has 2 vowels and 4 letters with a TV of (4*4/2=) 8. The words whose TV is closer to 0 are easier.

Question: Write a program that reads a name and surnames of (n) people. Then, the program prints the top (m) easy names. If there are two names whose difficulty is similar (TV difference is less than 0.0001) show in alphabetical order according to name and surname (name + surname).
Note: 1) ASCII table values are used when ordering: A is before B and Uppercase letters are smaller than lowercase letters. 2) Assume that spaces in the name are not count for calculating difficulty (only the letters count). 3) But the space is count when ordering: for example, 'Ana Maria' is before 'AnaMaria'. 4) All names (name+surname) have at least one vowel in them.
If needed you can use bool isVowel(char ch);
function from #include "utils/functions.h" library.

Input specification: You will be given two integers: the number of names (n), and the number of top (m) names to show. The following n lines contain a name and surname of n people separated by semicolon and space where names contain only 26 English uppercase or lowercase letters; and 0 ≤ m ≤ n ≤ 50,000.

Output specification: Show top m easy names.

Sample Input 1 Sample Input 2
6 3
Li; Peka
Bedjna Artemisa; Veliaj
Shi; Hysi
Li; Nemi
Fllanxha; Kasemi
Erban; Hasani
6 3
Elvi Terrence; Reka
Irvin; Canaj
Mo; Ortiz
Denise; Blloku
Gjorgja Long; Pjetri
Inr; Jensen
Sample Output 1 Sample Output 2
Li Nemi
Li Peka
Erban Hasani
Mo Ortiz
Irvin Canaj
Inr Jensen

Explanation: The list of Tiae names sorted according to difficulty for the sample input 1:
  Li Nemi 12
  Li Peka 12
  Erban Hasani 24.2
  Shi Hysi 24.5
  Fllanxha Kasemi 39.2
  Bedjna Artemisa Veliaj 44.444
Li Nemi and Li Peka have the same difficulty and thus they are sorted according to alphabetical order.



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

www.contester.ru