HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Linear Data Structures: Arrays > problem:


51121 - Complexity power of a number

Guest
• Review clarifications (1)

Section problems

• 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
• 50541 - Binary to decimal
• 50563 - Long Modulus
• 50567 - Input Data Normalization
• 50592 - Matrix Multiplication
• 50594 - Transformations
• 50606 - Long product
• 50607 - Long sum

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