Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int n, ap[1000], maxiNr = 0, v[1000];
- cin >> n;
- for (int i = 0; i < n; i++)
- {
- cin >> v[i];
- if (maxiNr < v[i])
- maxiNr = v[i];
- }
- for (int i = 0; i <= maxiNr; i++)
- ap[i] = 0;
- for (int i = 0; i < n; i++)
- ap[v[i]]++;
- int maxi = 0;
- for (int i = 0; i < n; i++)
- if (maxi < ap[i])
- maxi = ap[i];
- for (int i = 0; i <= maxiNr; i++)
- if (ap[i] == maxi)
- cout << i << ' ';
- return 0;
- }
Add Comment
Please, Sign In to add comment