Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string.h>
- using namespace std;
- int main()
- {
- int n;
- cin >> n;
- int *arr = new int[n];
- for (int i = 0; i < n; i++)
- std::cin >> arr[i];
- int zero_count = 0;
- int max_count = 0;
- for (int i = 0; i < n; i++)
- {
- if (arr[i] == 0)
- zero_count++;
- else if (zero_count != 0)
- {
- if (zero_count != 1)
- if (zero_count > max_count)
- max_count = zero_count;
- zero_count = 0;
- }
- }
- cout << max_count;
- delete []arr;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement