第一题:分糖果 n, k = 5, 10 A = [2,1,5,2,4] tmp = [] for i in range(len(A)): tmp.append([A[i], i+1]) tmp.sort(key=lambda x: x[0]) target = k n = len(A) pre = 0 for i in range(len(tmp)): if (tmp[i][0] - pre) * n < target: target -= (tmp[i][0] - pre) * n pre = tmp[i][0] ...