#C7351. Quality Spread Calculation
Quality Spread Calculation
Quality Spread Calculation
You are given several production runs, each with a list of quality scores. For each run, your task is to compute the difference between the maximum and minimum quality scores. In other words, if for a run the quality scores are \(s_1, s_2, \dots, s_n\), you need to output:
\(\text{spread} = \max\{s_1, s_2, \dots, s_n\} - \min\{s_1, s_2, \dots, s_n\}\)
The program should process several production runs provided via standard input and output the corresponding spread for each run on a new line.
inputFormat
The first line of the input contains an integer \(T\) representing the number of production runs. For each run, the input is given in two lines:
- The first line contains an integer \(N\), the number of quality scores in that run.
- The second line contains \(N\) space-separated integers representing the quality scores.
outputFormat
Output \(T\) lines, each line containing a single integer which is the difference between the highest and lowest quality scores for the corresponding production run.
## sample3
5
3 6 9 2 8
4
15 20 3 7
3
5 5 5
7
17
0
</p>