#C4694. Three Consecutive Days Above Threshold
Three Consecutive Days Above Threshold
Three Consecutive Days Above Threshold
Given a list of daily temperatures and a threshold temperature (T), determine whether there exist three consecutive days in which each day's temperature is strictly greater than (T). In other words, for a sequence (t_1, t_2, \dots, t_n), check if there exists an index (i) (with (1 \leq i \leq n-2)) such that
[ t_i > T, \quad t_{i+1} > T, \quad t_{i+2} > T ]
If such a sequence exists, output True; otherwise, output False.
inputFormat
The input is read from standard input (stdin) in the following format:
- The first line contains a single integer (n), the number of days.
- The second line contains (n) space-separated integers representing the temperatures on each day.
- The third line contains a single integer (T), the threshold temperature.
outputFormat
Output a single line to standard output (stdout) containing either True or False, indicating whether there exist three consecutive days with temperatures strictly greater than (T).## sample
8
73 74 75 71 69 72 76 73
70
True