Guest User

Untitled

a guest
May 26th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. z = int(raw_input())
  2.  
  3. while z:
  4. try:
  5. t = raw_input().split()
  6. n = int(t[0])
  7. suma = 0
  8. seg = t[1:]
  9. if len(t)==1:
  10. print "0"
  11. else:
  12. if n==1:
  13. suma = suma + int(seg[0])
  14. else:
  15. for x in seg:
  16. suma = suma + int(x)
  17. suma = suma + (len(seg)-1)
  18. print suma
  19. z-=1
  20.  
  21. except EOFError:
  22. break
Add Comment
Please, Sign In to add comment