Help! Can you point the problem here?

This code runs fine with custom input, but error on submitting and with custom input turned off.

CodeChef: Practical coding for everyone.

Earlier it showed this error:
Exception in thread “main” java.util.NoSuchElementException: No line found
at java.util.Scanner.nextLine(
at Codechef.main(

I tried to solve this by adding if(sc.hasNextLine()), but the problems kept increasing, and I ended up with the current solution.

For the latter: New to Codechef. Can't understand the platform - #3 by ssjgz

I’m putting the inputs given in instructions, but it still shows the error.
Could it be because of how Codechef IDE works, and shows NZEC error on no inputs? But that shouldn’t be a problem on submitting.

Did you try inputs having two (or more) digit numbers?

1 Like