#C680. Temperature Statistics by Region
Temperature Statistics by Region
Temperature Statistics by Region
You are given temperature readings for different regions. Each region has several temperature recordings. Your task is to compute the average (rounded to one decimal place), maximum, and minimum temperature for each region.
The input is provided as follows:
- The first line contains an integer n representing the number of regions.
- Each of the next n lines starts with an integer k (the number of temperature readings for that region) followed by k space-separated integers representing the temperature readings.
The output should contain n lines. For each region, output a line with four space-separated values:
- Region index (1-based)
- The average temperature (rounded to one decimal place). Formally, \( \text{average} = \frac{\sum_{i=1}^{k} t_i}{k} \), rounded to one decimal place.
- The maximum temperature.
- The minimum temperature.
Ensure that you read from stdin and write your result to stdout.
inputFormat
The first line contains a single integer n indicating the number of regions. The next n lines each begin with an integer k, representing the number of temperature readings for that region, followed by k space-separated integers.
Example:
3 6 72 75 78 79 74 73 5 65 68 71 64 66 4 81 83 85 87
outputFormat
For each region, output a line containing four space-separated values: the region index (starting from 1), the average temperature rounded to one decimal place, the maximum temperature, and the minimum temperature.
Example output for the above input:
1 75.2 79 72 2 66.8 71 64 3 84.0 87 81## sample
3
6 72 75 78 79 74 73
5 65 68 71 64 66
4 81 83 85 87
1 75.2 79 72
2 66.8 71 64
3 84.0 87 81
</p>