题解 | 支付宝消费打折

支付宝消费打折

https://www.nowcoder.com/practice/f8997c9b82714f058e12433a32614993

n, k = map(int,input().split())
jia = list(map(int, input().split()))
b = input()
hao = []
for i in b:
    hao.append(int(i))
zu = list(zip(jia,hao))
zhong = []
for x, y in zu:
    if y == 1:
        x = x * 0.95
    zhong.append(x)
zhong.sort()
g = 0
s = 0
while s < k:
    s += zhong[g]
    g += 1
if s == k:
    print(g)
else:
    print(g-1)




全部评论

相关推荐

评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务