We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
earnings = 0
for c in customers:
if c[0] not in shoes: continue
shoes[c[0]] -= 1
earnings += c[1]
if (shoes[c[0]] <= 0): del shoes[c[0]]
print(earnings)
if name=='main':
input() # We really don't use this info (number of shoes).
shoes = Counter(map(int, input().split()))
n = int(input())
customers = []
for _ in range(n):
shoe_size, price = map(int, input().split())
customers.append((shoe_size, price))
calc_earnings(shoes, customers)
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
collections.Counter()
You are viewing a single comment's thread. Return to all comments →
from collections import Counter
def calc_earnings(shoes, customers):
if name=='main':