How to find NZEC error ??

[Solution][1]
-> Why does this code gives NZEC??

Thank You
[1]: https://www.codechef.com/viewsolution/17499462

adding an exception handler which does nothing removes the nzec error

java example:

try
{
} catch (Exception e){}

actually i use to code in python where there is no such use of return 0 statement.
I have submitted many problems in Python.

Then its due to some exception trace your source code carefully

1 Like

my code is

import java.io.;
import java.lang.
;
public class sum
{
public static void main (String[] args)throws Exception
{
java.io.BufferedReader r = new java.io.BufferedReader (new java.io.InputStreamReader (System.in));
System.out.println(“Enter the number”);
int i=Integer.parseInt(r.readLine());
int sum=0;
for(int j=1;j<i;j++)
{
if(i%j==0)
{
sum+=j;
} }
System.out.println(sum);
}
}

http://www.codechef.com/submit/DS10

But it is not showing any runtime error! What are you talking about? See-

If n>100 in your code , it will give you NZEC error

you can declare your array z dynamically or declare it with max value of n

Due to brute force consuming lot of memory in recursion calls and overflowing the memory stack. Use map data structure and memoization.

Thank you so much, i tried the memoization and got an AC.

can anyone tell me t=why NZEC error is there
solution
https://www.codechef.com/viewsolution/24654440
q
https://www.codechef.com/JUNE19/PROXYC