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

Турниры > CEN110 Midterm Session 1 > задача:


1. 51121 - Complexity power of a number

CEN110 Midterm Session 1

Старт: 11.мая.2017 в 09:52:00
Финиш: 11.мая.2017 в 10:24:00
Турнир завершён!
• Турнирная таблица

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

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

• 1. 51121 - Complexity power of ...

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

Если у вас есть предложения или пожелания по работе 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