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