Split N into two integers whose addition to A and B makes them equal | Function to calculate the splitted numbers ; Calculate X ; If X is odd ; No pair is possible ; Otherwise ; Calculate X ; Calculate Y ; Driver Code
def findPair ( A , B , N ) : NEW_LINE INDENT X = N - B + A NEW_LINE if ( X % 2 != 0 ) : NEW_LINE INDENT print ( " - 1" ) NEW_LINE DEDENT else : NEW_LINE INDENT X = X // 2 NEW_LINE Y = N - X NEW_LINE print ( X , Y ) NEW_LINE DEDENT DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT A = 1 NEW_LINE B = 3 NEW_LINE N = 4 NEW_LINE findPair ( A , B , N ) NEW_LINE DEDENT