HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Contests > CEN110 Midterm Session 1 > problem:


1. 51121 - Complexity power of a number

CEN110 Midterm Session 1

Start: May.11.2017 at 09:52:00 AM
Finish: May.11.2017 at 10:24:00 AM
The contest is finished!
• Contest scoreboard

Guest
• Review clarifications (1)

Contest problems

• 1. 51121 - Complexity power of ...

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
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