#C1743. Consecutive Temperature Subarray Check
Consecutive Temperature Subarray Check
Consecutive Temperature Subarray Check
Given an array of daily temperature readings, determine whether there exists a consecutive subarray of length k whose average temperature is strictly greater than a specified target value. The average of a subarray \(a_{i}, a_{i+1}, \dots, a_{i+k-1}\) is computed by \(\frac{a_{i} + a_{i+1} + \cdots + a_{i+k-1}}{k}\). If such a subarray exists, output Above Target
; otherwise, output Below Target
. In the case where k is greater than the number of temperature readings, simply output Below Target
.
inputFormat
The input is read from standard input (stdin) and consists of four lines:
- The first line contains an integer
n
representing the number of temperature readings. - The second line contains
n
space-separated integers representing the daily temperature readings. - The third line contains an integer
k
, the length of the subarray to consider. - The fourth line contains a number representing the target average temperature.
outputFormat
Output a single line to standard output (stdout) containing either Above Target
if a consecutive subarray of length k has an average strictly greater than the target, or Below Target
otherwise.
8
30 32 35 33 31 30 29 28
3
32
Above Target