Reduce N to 0 or less by given X and Y operations | Function to check if N can be reduced to <= 0 or not ; Update N to N / 2 + 10 at most X times ; Update N to N - 10 Y times ; Driver Code
def NegEqu ( N , X , Y ) : NEW_LINE INDENT while ( X and N > N // 2 + 10 ) : NEW_LINE INDENT N = N // 2 + 10 NEW_LINE X -= 1 NEW_LINE DEDENT while ( Y ) : NEW_LINE INDENT N = N - 10 NEW_LINE Y -= 1 NEW_LINE DEDENT if ( N <= 0 ) : NEW_LINE INDENT return True NEW_LINE DEDENT return False NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT N = 100 NEW_LINE X = 3 NEW_LINE Y = 4 NEW_LINE if ( NegEqu ( N , X , Y ) ) : NEW_LINE INDENT print ( " Yes " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " No " ) NEW_LINE DEDENT DEDENT