I'm solving this problem but there is a little problem for first test case my solution on visual studio returns (2 6) the right answer. after submitting i get wrong answer on test case 1!! getting (1 6) either than (2 6). here is my code please can any one tell me what's the problem?!! thanks in advance!
Our old friend, the undefined behavior, strikes again! See, for instance, this:
http://stackoverflow.com/questions/11132236/why-does-increment-operation-like-ai-i-result-in-undefined-behavior
thank you, i know what's wrong now :-)