#K65212. Minimum Water Bottles
Minimum Water Bottles
Minimum Water Bottles
You are given a number of test cases. For each test case, you are provided with an integer ( n ) followed by ( n ) integers representing the number of water bottles needed at each checkpoint. Your task is to compute the total number of water bottles required for each test case.
In other words, for each test case, if the water bottles needed at each checkpoint are ( a_1, a_2, \ldots, a_n ), you should output the sum: ( S = \sum_{i=1}^{n}a_i ).
inputFormat
The input is given from standard input and has the following format:
- The first line contains an integer ( T ) (1 ( \leq T \leq 10^4 )) representing the number of test cases.
- For each test case:
- The first line contains an integer ( n ) (1 ( \leq n \leq 10^5 )) denoting the number of checkpoints.
- The second line contains ( n ) space-separated integers ( a_1, a_2, \ldots, a_n ) (each ( 1 \le a_i \le 10^9 )), representing the water bottles needed at each checkpoint.
outputFormat
For each test case, output a single line containing the total number of water bottles required (i.e. the sum of the given ( n ) integers).## sample
3
3
8 4 6
5
1 2 3 4 5
4
7 3 9 3
18
15
22
</p>