I submitted a solution for the problem "Life, the Universe, and Everything", based on the sample input and output. I got a Run time Error (NZEC). I googled the cause of this error and got to know that online platforms expect input delimited by space. So I changed the code and resubmitted and I got "Wrong Answer". I know my both my solutions work but do not know what CodeChef Expects. Please help. Solution 1: (this gave runtime error, input is as per sample input one below the other)
Solution 2: (This gave wrong Answer, input is on one line delimited by space)
asked 26 Jul '18, 09:46 ![]()
|
Hello ma'am, You need to take input assuming that the input will come in the format given in sample input. Here it is 1 integer input in each line as mentioned in the question here: www.codechef.com/TTPUNE/problems/TEST/ Kindly try and modify your program accordingly. answered 26 Jul '18, 12:56 ![]()
The "Solution 1" was accepting input as per sample. But that gave runtime error NZEC hence I modified the code. The issue is that the question does not specify when to stop the input. I assumed a NULL (i.e. ENTER without value) means the input has stopped and the output should start.
(27 Jul '18, 10:59)
I submitted this solution and CODECHEF accepted it, even though it does not satisfy the input and output requirements.
(27 Jul '18, 11:21)
The problem says that keep accepting input and print it till the user enters 42. The above program is satisfying the given requirements and so it worked.
(27 Jul '18, 18:55)
But it does not match sample input and sample output!!!
(28 Jul '18, 10:16)
|