In this question I used bufferedReader for my java code. Although the approach was fine but still showed RE. So i had to use scanner and it worked fine. So how to know when to use scanner and when to use bufferedreader.
Sed Sequences
Your solution didn’t give TLE. It gave Runtime Error. There might be some Exception that occured which resulted in RE. Remember, Buffered Reader will always run faster when compared to Scanner. What you should learn is how to tackle Run-time errors. Using try catch block or some other debugging techniques.
try:
t=int(input())
for i in range(t):
N,K=int(input().split(" "))
sum=0
for j in range(0,N):
a=int(input())
sum=sum+a
if(sum%K==0):
print(“0 \n”)
else:
print("1 \n")
except EOFError:
pass
i dont know why i am getting RE (NZEC) with this code …although i am using try except… can any one help
Sorry bro not good with python
I think, the input of the array was in a line i.e. a1,a2,…,an and not in separate lines. So, use a map to take input in one line and it should give AC