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

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


51121 - Complexity power of a number

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

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

• 51124 - Easy Tiae words
• 51145 - Graduation Exam
• 51117 - The Most Crowded
• 51146 - Popular Baby Names
• 51131 - Running After a Thief
• 51143 - Departments Competition
• 51132 - Problem Solving Competition
• 51118 - Place 7 to the 5th position
• 51121 - Complexity power of a n...
• 51119 - Evaluating Prefix expressions
• 2 ->10
• 50563 - Modul i gjate
• 50567 - Normalizimi Min Max
• 50592 - Shumezimi i Matricave
• 50594 - Transformimet
• 50606 - Длинное произведение
• 50607 - Длинная сумма

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

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

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

Complexity power of a number

One of your professors defines complexity power (CP) of a number as follows,

For example, the number 25 has two unique digits thus its CP is 12.5. However 222 has just one unique digit (2) and its CP is 222.

Question: Write a program that reads a list of numbers and shows the top m CP numbers. (If any two numbers have the same CP, show smaller one first).

Input specification: You will be given two integers: the number of numbers (n), and the number of top numbers to show (m). The following n lines contain an integer (numbers are between ±2e9) where 0 ≤ m ≤ n ≤ 50,000.

Output specification: Show m integers.

Sample Input 1 Sample Input 2
6 3
266
288
491
181
988
126
8 4
47
144
555
48
322
565
648
99
Sample Output 1 Sample Output 2
988
491
288
555
565
648
322

Explanation: Following list shows the numbers and their complexity power for the sample input 2:
  555 555
  565 282.5
  648 216
  322 161
  99 99
  144 72
  48 24
  47 23.5



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

www.contester.ru