Robert has a special set of cards to play with. Each card has an integer written on it and the integer can be negative, positive, or zero. The absolute value of the integer on the card cannot exceed x.
Now, Robert misplaced some of the cards and currently has only N cards. He wants to have the sum of integers present on the cards to be zero.
Find the minimum number of cards that Robert has to add to N cards to make the sum of integers present on all the cards to be zero.
• The first line contains an integer T denoting the number of test cases.
• The first line of each test case contains two space-separated integers Nx denoting the number of cards and maximum absolute value present on the card.
• The second line of each test case contains N space-separated integers denoting the integer written on N cards.
Output format
For each test case, print the minimum number of cards that Robert has to add to satisfy the conditions.
cases = int(raw_input())
for case in range(cases):
N = int(raw_input())
result = 1
for i in range(1, N + 1):
result = result * i
print result
Comments
Leave a comment