#公平的糖果交换
def func(A,B): sum_a = sum(A) sum_b = sum(B) setB = set(B) for x in A: if x+(sum_b-sum_a)//2 in setB: return [x,int(x+(sum_b-sum_a)//2)] else: return [] B=[2] A=[1,3] print(func(A,B))
#公平的糖果交换
def func(A,B): sum_a = sum(A) sum_b = sum(B) setB = set(B) for x in A: if x+(sum_b-sum_a)//2 in setB: return [x,int(x+(sum_b-sum_a)//2)] else: return [] B=[2] A=[1,3] print(func(A,B))