Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- using namespace std;
- int main()
- {
- ios_base::sync_with_stdio(false);
- cin.tie(NULL);
- int n; cin >> n;
- unsigned int a[n];
- for(int i = 0; i < n; i++)
- {
- cin >> a[i];
- }
- int counter = 1;
- vector<int> v;
- int temp = a[0];
- for(int i = 1; i < n; i++)
- {
- if(temp <= a[i])
- {
- temp = a[i-1];
- counter++;
- }
- else
- {
- temp = a[i];
- v.push_back(counter);
- counter = 1;
- }
- }
- v.push_back(counter);
- int maxCount = v[0];
- for(int i = 1; i < v.size(); i++)
- {
- if(maxCount < v[i])
- maxCount = v[i];
- }
- cout << maxCount;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement