#K10066. Average Temperature Calculation
Average Temperature Calculation
Average Temperature Calculation
You are given temperature readings from n sensors over m time intervals. Some readings may be missing, and these missing values are represented by -1000
. Your task is to compute the average temperature for each time interval considering only the valid readings. If an interval has no valid readings (i.e. all sensors provide -1000
for that interval), output 0.00
for that interval.
The average must be rounded to two decimal places. The final result should list the averages for all m intervals in order, separated by spaces.
Note: All input is provided via standard input and the output must be printed to standard output.
inputFormat
The first line of input contains two integers n and m representing the number of sensors and the number of time intervals respectively. This is followed by n lines, each containing m integers representing the temperature readings of each sensor for the m time intervals. A reading of -1000
indicates a missing measurement.
outputFormat
Output a single line containing m numbers: the average temperature for each time interval rounded to two decimal places. The numbers should be separated by a space.
## sample3 4
23 25 -1000 28
22 24 26 27
24 23 27 -1000
23.00 24.00 26.50 27.50