#K59017. Maximum Battery Consumption Difference

    ID: 30771 Type: Default 1000ms 256MiB

Maximum Battery Consumption Difference

Maximum Battery Consumption Difference

In this problem, you are given several test cases. For each test case, you are provided with a list of battery consumption rates corresponding to different scenarios. Your task is to calculate the maximum difference between these consumption rates.

More precisely, for a list of rates \(\{a_1, a_2, \ldots, a_N\}\), you need to compute:

$$ D = \max\{a_i\} - \min\{a_i\} $$

Your program must read the input from standard input (stdin) and write the result for each test case on a new line to standard output (stdout).

inputFormat

The input begins with a single integer \(T\) representing the number of test cases. For each test case:

  • The first line contains an integer \(N\), the number of scenarios.
  • The next line contains \(N\) space-separated integers representing the battery consumption rates.

You need to process all test cases in the order they are given.

outputFormat

For each test case, output a single integer on a new line denoting the maximum difference between any two battery consumption rates.

## sample
1
5
20 40 60 80 100
80

</p>