Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <map>
- using namespace std;
- int main()
- {
- int n, x, k = 0;
- cin >> n;
- map<int, int> values;
- for (int i = 0; i < n; i++)
- {
- cin >> x;
- if (values.find(x) != values.end())
- {
- values.at(x) += 1;
- }
- if (values.find(x) == values.end())
- {
- values.insert(pair<int, int> (x, 1));
- }
- if (values[x] == 4)
- {
- k += 1;
- values.at(x) = 0;
- }
- }
- cout << k << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement