Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб. Question by Ibrahim Mesecan.
Easy Tiae words
Dr. Tiae has difficulty reading words with too many consonants.
She likes the words with more vowels (a, e, i, o, and u).
She defines the ease of a word
For example, the word "Lai" has 2 vowels and 3 letters.
So, its TV is 66.667 . The values closer to 0
are difficult, the values closer to 100 are easier.
As another example Eyjafjallajokull is a difficult word,
because it has 6 vowels with a TV 37.5.
Question: Write a program
that reads a list of (n) words. Then, the program
prints the top (m) easy Tiae words. If there are
two words whose difficulty is similar (TV difference
is less than 0.0001) show the words in
alphabetical order (A is before B).
Note:
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 words
(n), and the number of top (m) Tiae words to show.
The following n lines contain a word (words
contain only 26 English uppercase or lowercase letters)
where 0 ≤ m ≤ n ≤ 50,000.
Output specification:
Show top m easy words.
Sample Input 1 |
Sample Input 2 |
8 4
Yu
Tan
Ana
Elma
Alexander
Lorraine
Francesko
Tania
|
8 4
Tiziana
Oltiona
Astrit
Enisa
Gresa
Shi
Elidjona
Sabina
|
Sample Output 1 |
Sample Output 2 |
Ana
Tania
Elma
Lorraine
|
Enisa
Oltiona
Tiziana
Elidjona
|
Explanation: The list of Tiae words sorted
according to difficulty for the sample input 1:
Ana 66.667
Tania 60
Elma 50
Lorraine 50
Yu 50
Alexander 44.444
Francesko 33.333
Tan 33.333
The words "Elma" "Lorraine" and "Yu" have the same
difficulty. So, they are in alphabetical order.
Для отправки решений необходимо выполнить вход.
|