#K34182. Total Points Calculation
Total Points Calculation
Total Points Calculation
You are given several test cases. For each test case, the first line contains an integer \(P\) representing the number of participants. Each of the following \(P\) lines contains a participant's name, an integer \(G\) (the number of scores), followed by \(G\) space-separated integers representing the scores. Your task is to compute the total points for each participant.
The overall input starts with an integer \(T\) representing the number of test cases, followed by the data for each test case sequentially.
For a participant with scores \(a_1, a_2, \ldots, a_G\), the total points is defined as:
\[ \text{Total Points} = \sum_{i=1}^{G} a_i \]
Print the result for each participant on a new line in the same order as they appear in the input with the format: Name TotalPoints
.
inputFormat
The first line of input contains an integer \(T\) representing the number of test cases. For each test case:
- The first line contains an integer \(P\), the number of participants.
- Then, for each participant, there is a line containing:
- A string denoting the participant's name.
- An integer \(G\) indicating the number of scores.
- \(G\) space-separated integers denoting the scores.
outputFormat
Output the total points for each participant in the same order as they appeared in the input. Each line should contain the participant's name and their total points separated by a space.
## sample3
2
Alice 3 5 10 15
Bob 2 20 20
1
Charlie 4 7 8 9 10
3
Dave 1 100
Eva 2 30 40
Fay 3 2 3 4
Alice 30
Bob 40
Charlie 34
Dave 100
Eva 70
Fay 9
</p>