30分?

bai123 暗区传说 2024-05-24 20:44:23 5
#include <bits/stdc++.h>
using namespace std;
int n, a[105];
int main() {
    cin >> n;
    int cnt = 0, mx = 0;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        a[i + n] = a[i];
    }
    for (int i = 1; i <= 2 * n; i++) {
        if (a[i] > a[i + 1]) {
            cnt++;
        } else {
            mx = max(mx, cnt);
            cnt = 0;
        }
    }
    cout << mx;
    return 0;
}
{{ vote && vote.total.up }}