Advertisement
Guest User

Untitled

a guest
Jan 17th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. int f(int B[],int n,int &d)
  5. {
  6. int l = 1;int max=0;
  7.  
  8. for (int i = 0; i<n-1; i++)
  9. {
  10. if (B[i] <B[i+1]){
  11. l++;
  12. if (max<=l){
  13. max=l; d=i+2-l;
  14. }
  15. }
  16. else{l=1;}
  17.  
  18.  
  19. }
  20.  
  21. return max;
  22. }
  23.  
  24. int main()
  25. {
  26. int Z[]={1,2,3,4,7,0,1,5,11,15,19,105,225,4,9,1};
  27. int d=0;
  28. cout<<f(Z,16,d)<<" "<<d;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement