-
-
Notifications
You must be signed in to change notification settings - Fork 82
Expand file tree
/
Copy patheleicoes2.cpp
More file actions
43 lines (30 loc) · 657 Bytes
/
eleicoes2.cpp
File metadata and controls
43 lines (30 loc) · 657 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int n, temp;
vector<int> v;
cin >> n;
while (n--) {
cin >> temp;
v.push_back(temp);
}
sort(v.begin(), v.end());
vector< pair<int, int> > vetorzin;
vetorzin.push_back(make_pair(1, v[0]));
for (int i = 1; i < v.size(); i++) {
int found = 0;
for (int j = 0; j < vetorzin.size(); j++) {
if (vetorzin[j].second == v[i]) {
vetorzin[j].first++;
found = 1;
break;
}
}
if (!found) vetorzin.push_back(make_pair(1, v[i]));
}
sort(vetorzin.begin(), vetorzin.end());
cout << vetorzin.back().second << endl;
return 0;
}