Check if it is possible to move from ( 0 , 0 ) to ( x , y ) in N steps | Function to check whether it is possible or not to move from ( 0 , 0 ) to ( x , y ) in exactly n steps ; Driver code
def Arrive ( a , b , n ) : NEW_LINE INDENT if ( n >= abs ( a ) + abs ( b ) and ( n - ( abs ( a ) + abs ( b ) ) ) % 2 == 0 ) : NEW_LINE INDENT return True NEW_LINE DEDENT return False NEW_LINE DEDENT a = 5 NEW_LINE b = 5 NEW_LINE n = 11 NEW_LINE if ( Arrive ( a , b , n ) ) : NEW_LINE INDENT print ( " Yes " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " No " ) NEW_LINE DEDENT