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