Skip to content

Commit 0b303f0

Browse files
authored
Create collections.Counter()
0 parents  commit 0b303f0

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

collections.Counter()

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from collections import Counter
2+
n = int(input())
3+
shoe_size = list(map(int,input().split()))
4+
shoe_count = Counter(shoe_size)
5+
customers = int(input())
6+
totalcost = 0
7+
for _ in range(customers):
8+
size,amount = map(int,input().split())
9+
if size in shoe_count.keys() and shoe_count[size]!=0:
10+
totalcost+=amount
11+
shoe_count[size] -=1
12+
print(totalcost)

0 commit comments

Comments
 (0)