Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _USE_MATH_DEFINES
- #include <iostream>
- #include <conio.h>
- #include <string>
- #include <set>
- #include <map>
- #include <algorithm>
- #include <string>
- #include <math.h>
- #include <vector>
- #include <cmath>
- using namespace std;
- long long n, k[500001], prom, prom2, maxan;
- int main()
- {
- long long max;
- max = 0;
- cin >> n;
- for (int i = 1; i <= n; i++)
- cin >> k[i];
- sort(k + 1, k + n + 1);
- prom = k[1];
- prom2 = 1;
- maxan = prom;
- for (int i = 2; i <= n; i++)
- if (k[i] != prom)
- {
- if (prom2 > max)
- {
- maxan = prom;
- max = prom2;
- }
- prom = k[i];
- prom2 = 1;
- }
- else
- prom2++;
- if (prom2 > max)
- {
- maxan = prom;
- max = prom2;
- }
- cout << maxan;
- _getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment