Skip to content

Commit

Permalink
29
Browse files Browse the repository at this point in the history
  • Loading branch information
greenlemonT committed Jul 2, 2024
1 parent f6eff22 commit 8c48fb1
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions MSKIM/21to30/29.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
def solution(enroll,referral,seller,amount):
parent=dict(zip(enroll.referral))
total={name:0 for name in enroll}

for i in range(len(seller)):
money=amount[i]*100
cur_name=seller[i]
while money>0 and cur_name!="-":
total[cur_name]+=money-money//10
cur_name=parent[cur_name]
money//=10

return [total[name] for name in enroll]

0 comments on commit 8c48fb1

Please sign in to comment.