Make A , B and C equal by adding total value N to them | Python3 Program to Distribute integer N among A , B , C such that they become equal ; find maximum among the three elements ; summation of three elements ; check if difference is divisible by 3 ; Driver code
def distributeN ( A , B , C , n ) : NEW_LINE INDENT maximum = max ( A , B , C ) NEW_LINE sum = A + B + C NEW_LINE p = ( 3 * maximum ) - sum NEW_LINE diff = n - p NEW_LINE if diff < 0 or diff % 3 : NEW_LINE INDENT print " No " NEW_LINE DEDENT else : NEW_LINE INDENT print " Yes " NEW_LINE DEDENT DEDENT A = 10 NEW_LINE B = 20 NEW_LINE C = 15 NEW_LINE n = 14 NEW_LINE distributeN ( A , B , C , n ) NEW_LINE