Find the winner of a game of donating i candies in every i | Function to find the winning player in a game of donating i candies to opponent in i - th move ; Steps in which number of candies of player A finishes ; Steps in which number of candies of player B finishes ; If A 's candies finishes first ; Otherwise ; Candies possessed by player A ; Candies possessed by player B
def stepscount ( a , b ) : NEW_LINE INDENT chance_A = 2 * a - 1 NEW_LINE chance_B = 2 * b NEW_LINE if ( chance_A < chance_B ) : NEW_LINE INDENT return ' B ' NEW_LINE DEDENT else : NEW_LINE INDENT return " A " NEW_LINE DEDENT DEDENT A = 2 NEW_LINE B = 3 NEW_LINE print ( stepscount ( A , B ) ) NEW_LINE