Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio.h>
- #include <string>
- #include <math.h>
- #include <algorithm>
- #include <set>
- #include <map>
- struct wheels
- {
- int size;
- int pairwheel;
- };
- using namespace std;
- int main()
- {
- map <int, wheels> wheel;
- int n, prom;
- wheels prom2;
- prom2.size = 0;
- prom2.pairwheel = 1;
- set <int> size;
- cin >> n;
- for (int i = 1; i <= n; i++)
- {
- cin >> prom;
- if (wheel.find(prom) == wheel.end())
- {
- wheel.insert(pair <int, wheels>(prom, prom2));
- }
- else
- {
- wheel[prom].pairwheel = wheel[prom].pairwheel + 1;
- if (wheel[prom].pairwheel == 4)
- {
- wheel[prom].size = wheel[prom].size + 1;
- wheel[prom].pairwheel = 0;
- }
- }
- size.insert(prom);
- }
- int sum = 0;
- for (auto i = size.begin(); i != size.end(); i++)
- {
- sum = sum + wheel[*i].size;
- }
- cout << sum;
- _getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment