fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. #define MAX_N 1000
  6.  
  7. int main()
  8. {
  9. int n;
  10. cin >> n;
  11. int a[MAX_N];
  12. int lmax = -1;
  13. for (int i = 0; i < n; i++)
  14. cin >> a[i];
  15. for (int i = 0; i < n ; i++)
  16. {
  17. int j = i + 1;
  18. while (j < n && a[j - 1] <= a[j])
  19. j++;
  20. if (j - i > lmax)
  21. {
  22. lmax = j - i;
  23. }
  24. }
  25. cout << lmax + 1;
  26.  
  27. return 0;
  28. }
Success #stdin #stdout 0s 16064KB
stdin
8
9 2 2 3 4 5 1 8
stdout
6