Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 2c556a4

Browse files
Counter
1 parent 9ba5f48 commit 2c556a4

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
from collections import Counter
2+
n = int(input())
3+
shop = list(map(int, input().split()))
4+
c_number = int(input())
5+
counter_shop = Counter(shop)
6+
7+
sale = 0
8+
while c_number > 0:
9+
size, cost = input().split()
10+
size = int(size)
11+
cost = int(cost)
12+
for x, y in counter_shop.items():
13+
if size == x and y >= 1:
14+
sale += cost
15+
counter_shop[x] = y-1
16+
#print(counter_shop)
17+
c_number -= 1
18+
19+
print(sale)
20+
21+
22+
# 55 45 40 60

‎Hackerrank-Python3/compress_string.py

Whitespace-only changes.

‎Hackerrank-Python3/itertools_product.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from itertools import product
2+
3+
a = list(map(int, input().split()))
4+
b = list(map(int, input().split()))
5+
c = list(product(a, b))
6+
for i in range(len(c)):
7+
print(c[i], end=" ")

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /