Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
397 B
0
Indexable
Never
#include <iostream>
using namespace std;

int main() {
	int n = 0;
	int current = 0;
	int previous = 0;
	int length = 0;
	int maxLength = 0;
	cin >> n;

	for (int i = 0; i < n; i++) {
		cin >> current;
		if (current > 0) {
			length++;
			if (maxLength < length) {
				maxLength = length;
			}
		}
		else {
			length = 0;
		}
		previous = current;
	}
	cout << maxLength;
}