ZakenChannel

Untitled

Nov 17th, 2021
314
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4.  
  5. int main() {
  6. int n, m = 0, max = 0, t = 0;
  7. cin >> n;
  8. vector<int> arr(n);
  9. for (int i = 0; i < n; i++) {
  10. cin >> arr[i];
  11. }
  12. for (int i = 0; i < n; i++) {
  13. m = 0;
  14. for (int j = 0; j < n; j++) {
  15. if (arr[i] == arr[j]) {
  16. m++;
  17. }
  18. }
  19. if (max <= m) {
  20. max = m;
  21. t = i;
  22. }
  23. }
  24. cout << arr[t];
  25. }
Advertisement
Add Comment
Please, Sign In to add comment