RunTime Error(NZEC)

The code given below runs correctly on my PC but shows NZEC on submission ,I tried to solve it many times but it doesn’t work, please help me, thanks in advance. http://www.codechef.com/viewsolution/4558227

Your code reads input incorrectly. The StringTokenizer contains the content of array a. Why then are you reading input again if n!=0 and k!=0? Remove the spilt statement in the ‘else’ clause.

Basically, your program was trying to read inputs when there were none. Hence the exception. Hope this helps. :slight_smile:

1 Like

@rajat_dtc

Dude, what are you trying to say? Did you see the inputs? None of them made the program throw a run time exception. There is no divide by zero or negative array assignment as the constraints are pretty straightforward. Please atleast read the question you are eager to answer. I am sorry if I sound rude, but karma points are not going to get us anywhere. Try and help only if you feel like. :slight_smile:

I say this because there may be some people who will genuinely follow the advice and get stuck and depressed when it doesn’t work. Thats sad because they already need help when they post here. So please only answer if you feel the question has been understood. I don’t dare answer many because it’s beyond my understanding. Good morning :slight_smile:

//