Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<fstream>
- using namespace std;
- ifstream fin("date.in.cpp");
- int main()
- {
- int n=1,lcrt=1,lmax=0,x,aux,v[100],start=1,i;
- fin>>v[1];
- while(fin>>aux)
- {
- n++;
- v[n]=aux;
- if(v[n-1]>v[n])
- lcrt++;
- else
- {
- if(lcrt>lmax)
- {
- lmax=lcrt;
- start=n-lcrt;
- }
- lcrt=1;
- }
- }
- if(lcrt>lmax)
- {
- lmax=lcrt;
- start=n-lcrt;
- }
- for(i=start; i<=start+lmax-1; i++)
- {
- cout<<v[i]<<" ";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment