http://www.codechef.com/problems/B3

I am stuck with this prob but i can’t figure out. Can someone has explanation for this.

Thnks

# Battleship V

**kunal361**#2

I thinkthe problem says that…if ur cannon is at origin and u need to destroy a cannon at a pt X,Y then the line joining 0,0 and X,Y should not pass through a point whose “x” and “y” coordinates are integers!!!

for eg line joining 0,0 and 2,2 passes through 1,1 so cannon at 2,2 cannot be destroyed…whereas line joining 0,0 and 2,1 does not pass through any such points whose x as well y coordinates are integers…so cannon at 2,1 can be destroyed…hope this helps…