MostFrequentNumber
Здравейте,
имам нужда от помощ със задача Problem 4 – Most Frequent Number от C++ Fundamentals.
Дава ми само 60 точки
Това е моето решение:
Условие на задачата:
Write a program that finds the most frequent number in a given sequence of numbers.
- Numbers will be in the range [0…9].
- In case of multiple numbers with the same maximal frequency, print all of them, ordered from smallest to largest, separated by spaces
Examples
Input |
Output |
Output |
13 4 1 1 4 2 3 4 4 1 2 4 9 3 |
4 |
The number 4 is the most frequent (occurs 5 times) |
8 2 2 2 2 1 2 2 2 |
2 |
The number 2 is the most frequent (occurs 7 times) |
|
2 7 9 |
The numbers 2, 7 and 9 have the same maximal frequence (each occurs 3 times). |
Благодаря,реших задачата на чисто и се получи.