# 2019 IUSB Programming Competition # Round 1 Problem 6 # Can you reach a destination point from a source point # Solution by Dana Vrajitoru # Uses Python 3.6.2 def canReach(x1, y1, x2, y2): # base case: we're there already if x1 == x2 and y1 == y2: return True # another base case: we're past the destination elif x1 > x2 or y1 > y2: return False else: return canReach(x1, x1+y1, x2, y2) or canReach(x1+y1, y1, x2, y2) # Testing the function if __name__ == '__main__': print("Enter the coordinates") str = input().split(" ") x1 = int(str[0]) y1 = int(str[1]) x2 = int(str[2]) y2 = int(str[3]) if canReach(x1, y1, x2, y2): print("yes") else: print("no")