Module: (C++) Practicum - 3: Loop statements "A few facts about Harry Potter"


Problem

5 /7


Winter at Hogwarts

Problem

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 
The first line is a number N – total number of days to consider (\(1 <= N <= 100\)).
The following N lines specify one integer each. Each number – average daily temperature on the corresponding day. Temperatures – integers belonging to the range from –50 to 50.

Imprint
It is required to display one 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.
 

Examples
# Input Output Explanations
1 6
-20
30
-40
50
10
-10
 
2 We are considering 6 days. The longest thaw was on the 4th and 5th days (50 and 10 degrees respectively)
2 8
10
20
30
1
-10
1
2
3
 
4 The longest thaw was in the first 4 days
3 5
-10
0
-10
0
-10
0 There were no days with a positive temperature