fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. #define el "\n"
  4. #define ll long long
  5. #define ull unsigned long long
  6. #define se second
  7. #define fi first
  8. #define be begin()
  9. #define en end()
  10. #define Faster cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
  11.  
  12. int main()
  13. {
  14. Faster;
  15. int n; cin >> n;
  16. int a[n];
  17. int ans = 0;
  18. for(auto &x : a) cin >> x;
  19. for(int i = 0; i < n - 3; i++)
  20. {
  21. int ok = 1;
  22. for(int j = i + 1; j < i + 4; j++)
  23. {
  24. if(a[j] <= a[j-1])
  25. {
  26. ok = 0;
  27. break;
  28. }
  29. }
  30. if(ok == 1) ans++;
  31. }
  32. cout << ans;
  33. return 0;
  34. }
  35.  
Success #stdin #stdout 0s 5296KB
stdin
7
1 2 3 4 5 1 2
stdout
2