In CodeChef always exit the program using System.exit(0); CodeChef expects code should return a value at the end of the code. Also use BufferedReader to read input values rather than scanner. It will avoid Timeout error in code chef.
I’m so sorry, I mistakenly flagged your answer as spam and I can’t undo it
Also it’s not necessary to use
System.exit(0); as the default return value is
0 as long as
main() does not throw an Exception. But you can have my upvote as compensation.
guys, please upvote me. i am new here. nad not able to ask question
The question description is misleading. Quote
The first line of each test contains an integer G, denoting the number of games played by Elephant.
But the test case seems to put the G ONLY on the 2nd line.