I was solving CodeChef: Practical coding for everyone (Alternate Additions) in long Challenge. I found that if and only if B is even, the output will be YES otherwise NO.
But it gives WA for some of the Testcases.
Anyone can tell why?
U are doing the same mistake as I have done in starting of solving the problem.
Just see the explanation of the test cases, all your doubts will be clear.
@sece_mcs131 - in case you still havent been able to solve this problem, you can ask the doubt solvers here - CodeChef: Practical coding for everyone
I was also thinking the same at the start, but that’s not how it works as shown in the test cases.
For another example:
A = 2, B = 5, (Note B is odd, according to your statement the answer should be no)
first iteration:
i = 1; i is odd hence A = A+1, A = 3
second iteration:
i = 2; i is even now, hence A = A+2, A = 5
A became equal to B. Answer became “Yes”
I hope you understood