runtime error nzec

kind of new to this code chef. getting this error often even for the easy programs though i had tested them in other runtime environments. please help how to tackle them. thanks

There is some standard syntax you are expected to follow for your solution to be judged by the online judge used here. I am not a Java programmer so I cant help you properly. However I would suggest you read this FAQ and have a look at a few other solutions in Java. It will definitely help.

Remove the package declaration from your code… And following @kcahdog suggestion be sure to submit a solution to INTEST to test your Input Output routines… Using Scanner is not advised here, you can also refer to this post.

If you are coding in java, please take care of the following points:

  1. If the access modifier of your class is public, the class name MUST be Main.

  2. If the access modifier of your class is default, you may use ANY class name.

  3. The code should not include package declarations.

  4. For input, it is recommended to use BufferedReader instead of Scanner (which is slow). You may also go through the solutions by experienced java programmers who use custom InputReader class to read standard input.

  5. For output, it is recommended to use PrintWriter instead of System.out.print (which is slow). You may also use StringBuilder for questions involving handling of large strings.

Hope this helps!

3 Likes