Advertisement
Unnnamedddd

Untitled

Jan 1st, 2021
940
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.48 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int n, a, lenOfMax, count, previous;
  8.     cin >> n;
  9.     lenOfMax = 0;
  10.     count = 0;
  11.     previous = 0;
  12.     for (int i = 0; i < n; i++)
  13.     {
  14.         cin >> a;
  15.         if (a >= previous)
  16.             count++;
  17.         else
  18.         {
  19.             if (count > lenOfMax)
  20.                 lenOfMax = count;
  21.             count = 1;
  22.         }
  23.         previous = a;
  24.  
  25.     }
  26.     cout << lenOfMax << endl;
  27.     return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement