Thornhill Computer Club 2024 - February Mock CCC - Problem 3
Joe likes to go sledding. Of course, to go sledding, there must be snow. On any given day, snow will form if the temperature is below 0
degrees Celsius and the humidity is above 70
percent. However, Joe is an elitist sledder and will only go sledding if there is sufficient snow. Specifically, he will only go sledding on a given day if it has been snowing for at least two consecutive days directly before the given day.
Given the temperature and the humidity of different days. Determine how many good snow days Joe will get to go sledding.
Input Specifications
The first line will contain a single integer , the total number of days.
The next line will contain space-separated integers , the temperature of the th day in degrees Celsius.
The last line will contain space-separated integers , the percent humidity of the th day.
Output Specifications
On a single line, output a single integer , the number of days Joe finds suitable for sledding.
Sample Input 1
6
3 -2 -1 -4 -3 0
80 70 73 75 71 68
Sample Output 1
2
Explanation for Sample Output 1
It will snow on the 3rd, 4th, and 5th day. The first day is too warm for snow to form and the second day is not humid enough. The last day is not cold enough and not humid enough for snow to form. The 5th and 6th day are the only days good enough for Joe. Prior to the 5th day, it was snowing on the 3rd and 4th day. Prior to the 6th day, it was snowing on the 5th and 4th day. Since both these days had at least two days of snow prior to themselves, they satisfy Joe's conditions for a good snow day.
Sample Input 2
4
34 32 29 30
26 40 39 58
Sample Output 2
0
Explanation for Sample Output 2
It is too warm for snow to form, so there are no good days for Joe to go sledding. After all, Joe should not be attempting to sled in the summer.
Comments