Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- using namespace std;
- int main() {
- int n, m = 0, max = 0, t = 0;
- cin >> n;
- vector<int> arr(n);
- for (int i = 0; i < n; i++) {
- cin >> arr[i];
- }
- for (int i = 0; i < n; i++) {
- m = 0;
- for (int j = 0; j < n; j++) {
- if (arr[i] == arr[j]) {
- m++;
- }
- }
- if (max <= m) {
- max = m;
- t = i;
- }
- }
- cout << arr[t];
- }
Advertisement
Add Comment
Please, Sign In to add comment