Hey guy’s. i was practicing on Codechef on the medium section.
This is the problem i am working on: Marbles
This i my code: MyCode
When i submit it says NZEC. although i don’t think any of my code can throw any exception.
I experimented with a try except block and found out that the very last statement ie
is throwing an exception apparently. I cannot think why that would throw an NZEC. Someone please help.
The reason why the compilerr throws NZEC error is most probably you are leving the input section blank.
Pass the inputs to the function and then run the code. Otherwise your code is working perfectly fine.
Copied from GFG
EOFError is raised when one of the built-in functions input() or raw_input() hits an end-of-file condition (EOF) without reading any data. This error is sometimes experienced while using online IDEs. This occurs when we have asked the user for input but have not provided any input in the input box.
I was able to avoid the NZEC error by changing line 9 to use module division operator (// instead of /). My only (uneducated) guess is that turning c into a float by doing normal division was causing some kind of memory error, though I don’t really understand how.
I am sorry i don’t understand. Could you please outline what i should change in the code?
Also i checked using try except blocks the input is not causing the NZEC in any way. The last print(int©) statement is
Thank you very much. This seems to work. But it is Getting tle now. I’ll see how i can optimize.