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