天梯L2-003 月饼
L2-003 月饼 - 团体程序设计天梯赛-练习集
def slove():n,m = map(float,input().split())z = list(map(float,input().split()))y = list(map(float,input().split()))n = int(n)d = []for i in range(n):d.append([z[i],y[i]])d.sort(key = lambda x:x[1]/x[0],reverse = True)cnt,ans = 0,0while cnt < n and m > 0:if m >= d[cnt][0]:ans += d[cnt][1]m -= d[cnt][0]else:ans += m * (d[cnt][1] / d[cnt][0])m = 0cnt += 1print('%.2f' % ans)
slove()