My program works on eclipse but not when I submit it?

This makes no sense. I have tried submitting the same code like 5 times and I have gotten 2 wrong answers(which makes no sense since it works on eclipse) and 3 NZEC runtime errors. I have no idea how to do this. My code works, but codechef doesn’t accept it. I don’t understand how this works at all. I tried custom inputs and it compiled just fine, even gave me the correct answers. Someone help me.

CodeChef (like most other online judges) has hidden test cases that aren’t revealed to us. Even if your program passes the sample test case they give, it may be wrong or crash on the hidden test data. Even though there’s only 1 test case on the submission, it is probably a different one than the sample they give. In this case, you should check your program and make sure it works for all possible inputs.

To be even more specific, your submission fails on the following case:

9 11

(answer should be 92, you print 100), and you shouldn’t include a package name or print "Enter the num of test cases: ".

1 Like

THANK YOU SO MUCH!! I completely overlooked that issue! Thanks to you I’ve finally done my first successful submission. It’s super satisfying!