fork download
  1. #include <stdio.h>
  2.  
  3. int main() {
  4. long long int n, ant=0, atual = 0, i, seq = 0, longest = 0;
  5.  
  6. scanf("%I64d", &n);
  7.  
  8. for(i=0;i<n;i++) {
  9. scanf("%I64d", &atual);
  10. if(atual >= ant) {
  11. seq++;
  12. } else{
  13. if(seq > longest) {
  14. longest = seq;
  15. }
  16. seq = 1;
  17. }
  18. ant = atual;
  19.  
  20. //printf("ant %d - atual %d - seq %d - longest %d\n", ant, atual, seq, longest);
  21. }
  22. if(seq > longest) {
  23. longest = seq;
  24. seq = 1;
  25. }
  26.  
  27. if(longest == 0 && seq > 0)
  28. longest = seq;
  29. else if(longest==0 && seq == 0)
  30. longest = 1;
  31.  
  32. printf("%I64d\n", longest);
  33.  
  34.  
  35. return 0;
  36. }
  37.  
Success #stdin #stdout 0s 3464KB
stdin
Standard input is empty
stdout
                                                               1