Skip to content

Commit

Permalink
add examples
Browse files Browse the repository at this point in the history
  • Loading branch information
zehengl committed Mar 19, 2024
1 parent 2327f39 commit 8edd48a
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/candystore.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
n, q = [int(d) for d in input().split()]
m = {}
for _ in range(n):
name = input()
init = "".join([p[0] for p in name.split()])
if init not in m:
m[init] = name
else:
m[init] = "ambiguous"
for _ in range(q):
print(m.get(input(), "nobody"))
7 changes: 7 additions & 0 deletions src/ferskastajarmid.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
n = int(input())
memes = {}
for _ in range(n):
item = input().split()
meme, score = item[0], int(item[1]) * int(item[2])
memes[meme] = score
print(max(memes, key=lambda v: (memes[v], -sorted(memes).index(v))))
9 changes: 9 additions & 0 deletions src/keysphonewallet.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
n = int(input())
items = [input() for _ in range(n)]
ready = True
for item in ["keys", "phone", "wallet"]:
if item not in items:
print(item)
ready = False
if ready:
print("ready")
5 changes: 5 additions & 0 deletions src/pencilcrayons.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
n, k = [int(d) for d in input().split()]
t = 0
for _ in range(n):
t += k - len(set(input().split()))
print(t)

0 comments on commit 8edd48a

Please sign in to comment.