I have applied my logic, and got all correct answers on my PC, also my program is working fine with M,N<10^9, and yeah i am not using any nested loops.
Please help me. I have got wrong answer about 15 times. This is really disappointing me.
2 Likes
Check for the data types and logic again.
Yes you do not need to use any loops but look if the logic you have applied matches with the answer that you will get by mathematically solving the problem.