python这个WA了四个点,debug不出来了,请求大佬帮忙看看,非常感谢
查看原帖
python这个WA了四个点,debug不出来了,请求大佬帮忙看看,非常感谢
339332
qianyan_楼主2020/4/29 22:33
N,T=map(int,input().split())
weight={}
average=[]
for i in range(N):
    m,v=map(int,input().split())
    a=v/m
    if a not in average:
        average.append(a)
    if a not in weight:
        weight[a]=m
    else:
        weight[a]+=m
sorted(average)[::-1]
left=T
money=0
for i in average:
    if weight[i]<=left:
        money+=weight[i]*i
        left-=weight[i]
    else:
        money+=i*left
        break
print('%.2f'%money)
2020/4/29 22:33
加载中...