such a way that each move is a diagonal step, that is, consists of one unit to the right or left followed by one unit either up or down.
a) Which points (p,q) can be reached from the origin?
b) What is the minimum numbers of moves needed to reach such a point (p,q) ?
Ans:
) In each move x cordinate goes up/down by 1 and y cordinate goes up or down by 1 so x+y sum changes by an even number.
the starting point is (0,0) so sum of x and y is even so p+q should be even.
b) if p + q is odd then we cannot go
so let p+ q be even.
then number of steps required is maximum(|p|,|q|)
to explain say q and p positive and q> p
so we require q steps to wards y side up and out of it p + (q-p)/2 steps to the right and (q-p)/2 steps to left
note: if some term above is -ve then move that many positive steps in opposite direction
No comments:
Post a Comment