Run Time error in problem RRSTONE!!

I have covered all the cases but still my code is giving Run-Time error, Can anyone tell where am I missing??
My solution:-
http://www.codechef.com/viewsolution/4186633

Problem link:-

First of all, its not the runtime error but wrong answer and Secondly as a hint, try to find out some pattern in the sequence. If you have any further query, feel free to ask.

Yeah I know the pattern but if you submit the above code of mine, the compiler shows runtimeerror(NZEC). I think the logic is ok but I am not able to understand what is making this error!

Yes it is a runtime error. I overlooked the solution but the problem with you code is that your probably missed the stdlib.h header file.

Tried that also bro, still the same problem.

@mrigank: RUNTIME error in your code is due to the return value in main function that is in your case when (k==0) your are just returning but you should return 0 as return type of your main function is int and include stdlib or else you may encounter compile error. If this information is useful to you feel free to upvote and accept my answer :slight_smile:

1 Like

Ah! such a silly mistake. Thanks it helped!! :slight_smile:

//