Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int n, nr, l, st, stmax, lmax;
- cin >> n;
- l = lmax = 0;
- for (int i = 1; i <= n; i ++) {
- cin >> nr;
- if (nr == 0)
- l ++;
- else
- l = 0;
- if (l == 1)
- st = i;
- if (l > lmax) {
- lmax = l;
- stmax = st;
- }
- }
- cout << stmax << " " << stmax + lmax - 1;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement