Author: loop3r
Date: 20260223
tag: 模拟
link: https://www.luogu.com.cn/problem/P1893问题描述
分析
按题意模拟。
参考代码
cpp
#include <bits/stdc++.h>
using namespace std;
int n, a[10010];
int main() {
cin >> n;
for (int i = 0; i < n; i++) cin >> a[i];
int ans = 0;
for (int i = 0; i < n; i++) {
int j = i + 1, len = 1;
while (j < n && a[j] <= a[j - 1]) j++, len++;
j = i - 1;
while (j >= 0 && a[j] <= a[j + 1]) j--, len++;
ans = max(ans, len);
}
cout << ans << endl;
return 0;
}