Quantcast
Viewing all articles
Browse latest Browse all 39796

What is wrong with this approach in solving problem JADEJA?

I read this problem and concluded that we have to count the number points with integral coordinates(both coordinates). So with two given points I got the equation of the line and then by looping from minimum of x1,x2 to maximum of x1,x2 (excluding both), I am calculating the value of y (by using the above equation of line). And hence the number of "integral" y coordinates will be the answer. Fortunately I am getting wrong answer. Please rectify any mistakes in this approach and please don't suggest any new approach.


Viewing all articles
Browse latest Browse all 39796

Trending Articles