Python HackerRank 문제 26 - collections.Counter()


Python HackerRank 문제 26 - collections.Counter()

Python HackerRank 문제 26 - collections.Counter() collections.Counter() 풀이 from collections import Counter stock = int(input()) sizes = input().split() cnt = Counter(sizes) orders = [input().split() for i in range(int(input()))] bill = 0 for order in orders: if order[0] in cnt.keys() and cnt[order[0]]>0: bill=bill+int(order[1]) cnt[order[0]]-=1 print(bill) * 출처 collections.Counter() | HackerRank Use a counter to sum the amount of money earned by the shoe shop owner. www.hackerrank.com...


#HackerRank_collections_Counter #Python #Python_collections_Counter #Python_HackerRank #Python_HackerRank_collections_Counter

원문링크 : Python HackerRank 문제 26 - collections.Counter()