SelinD

V64s3e4

Feb 19th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. #include<iostream>
  2. #include<fstream>
  3. using namespace std;
  4. ifstream fin("date.in.cpp");
  5. int main()
  6. {
  7. int n=1,lcrt=1,lmax=0,x,aux,v[100],start=1,i;
  8. fin>>v[1];
  9. while(fin>>aux)
  10. {
  11. n++;
  12. v[n]=aux;
  13. if(v[n-1]>v[n])
  14. lcrt++;
  15. else
  16. {
  17. if(lcrt>lmax)
  18. {
  19. lmax=lcrt;
  20. start=n-lcrt;
  21. }
  22. lcrt=1;
  23. }
  24. }
  25. if(lcrt>lmax)
  26. {
  27. lmax=lcrt;
  28. start=n-lcrt;
  29. }
  30. for(i=start; i<=start+lmax-1; i++)
  31. {
  32. cout<<v[i]<<" ";
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment