Problem Author: | Hasan Saleh (MathModel) |
Prepared by: | Hasan Saleh (MathModel) |
Edited by: | Hasan Saleh (MathModel) |
Solution
Just simulate the moves , each time you reach point increase the count by , after finishing processing print the count.
for _ in range(int(input())):
n,x=map(int,input().split())
a=list(map(int,input().split()))
ans=0
if(x==0):ans=1
for i in range(n):
x+=a[i]
if(x==0):
ans+=1
print(ans)Complexity