Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <map>
- using namespace std;
- int main()
- {
- system("chcp 1251");
- cout << "Task 4\n";
- int coupes[54];
- for (int i = 0; i < 36; i++) {
- coupes[i] = i / 4;
- }
- for (int i = 36; i < 54; i++) {
- coupes[i] = 8 - (i - 36) / 2;
- }
- long N;
- for (int i : coupes)
- cout << i;
- cout << "\n";
- map <int, int> m;
- cout << "N = ";
- cin >> N;
- int idx = 0;
- for (int i = 0; i < 9; i++)
- m[i] = 0;
- for (int i = 0; i < N; i++) {
- cin >> idx;
- idx--;
- m[coupes[idx]]++;
- }
- for (int w=0; w<9; w++) {
- if (m[w] >= 6)
- m[w] = 1;
- else
- m[w] = 0;
- }
- int maxim = 0;
- int counter = 0;
- for (int i = 0; i < 9; i++) {
- if (m[i] == 1) {
- counter++;
- }
- else
- counter = 0;
- if (counter > maxim)
- maxim = counter;
- }
- cout << maxim;
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment