Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- //ifstream f("saci.in");
- //ofstream g("saci.out");
- int main()
- {
- int n,i,j=0,maxim=0,nr=0,x;
- cin>>n;
- for(i=1;i<=n;i++)
- {
- cin>>x;
- if(x==0)
- nr++;
- else
- {
- if(nr>maxim)
- {
- maxim=nr;
- j=i-1;
- }
- nr=0;
- }
- }
- if(x==0)
- {
- if(nr>maxim)
- {
- maxim=nr;
- j=i-1;
- }
- nr=0;
- }
- x=j-maxim+1;
- cout<<x<<" "<<j;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement