Untitled

mail@pastecode.io avatar
unknown
c_cpp
7 months ago
665 B
0
Indexable
Never
#include <iostream>
#include <cmath>
#include <string>
using namespace std;

int main() {

    int n,count = 0,maxim = 0;
    bool last_big = false;

    cin >> n;

    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        if (a > 0) {
            if (last_big == false) {
                count = 1;
                last_big = true;
            }
            else {
                count += 1;
            }
            if (maxim < count) {
                maxim = count;
            }
        }
        else {
            last_big = false;
            count = 0;
        }
    }
    cout << maxim;
    return 0;
}