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