Олимпиадный тренинг

Задача 37500. Winter at Hogwarts


Задача

Темы: Цикл for
JK Rowling, Harry Potter and actor Daniel Radcliffe were all born on the same day – July 31st. One of my favorite seasons is winter

Tired of an unusually warm winter, the people of Hogwarts decided to find out if this was really the longest thaw on record. They turned to weather forecasters, who, in turn, began to study the statistics for the past years. They are interested in how many days the longest thaw lasted.

They call a thaw a period in which the average daily temperature exceeded 0 degrees Celsius every day.
Write a program to help weather forecasters in their work.

Input data: Start with a number N – total number of days considered (1 <= N <= 100).
The next N lines contain one integer each. Each number – average daily temperature on the corresponding day. Temperatures – integers belonging to the range from –50 to 50.

Output: You need to output a single number – the length of the longest thaw, that is, the largest number of consecutive days during which the average daily temperature exceeded 0 degrees. If the temperature on each day was non-positive, print 0.

Explanations for examples:

1) 6 days are considered. The longest thaw was on the 4th and 5th days (50 and 10 degrees respectively)
2) The longest thaw was in the first 4 days
3) There were no days with a positive temperature

Examples

# Input Output
1 6
-20
30
-40
50
10
-10
 
2
2 8
10
20
30
1
-10
1
2
3
 
4
3 5
-10
0
-10
0
-10
0

Запрещенные операторы:list;[