Answer to Question #280895 in Python for Rahul Sigh

Question #280895

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.


Input format


•  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.


1
Expert's answer
2021-12-20T10:03:45-0500
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

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS