๋ฌธ์
https://school.programmers.co.kr/learn/courses/30/lessons/176963
ํ์ด
# ํ๋ก๊ทธ๋๋จธ์ค 1๋จ๊ณ - ์ถ์ต ์ ์
def solution(name, yearning, photo):
answer = []
d = {}
for i in range(len(name)):
d[name[i]] = yearning[i]
for i in range(len(photo)):
res =0
for j in range(len(photo[i])):
if photo[i][j] in d:
res += d[photo[i][j]]
answer.append(res)
return answer
print(solution(["may", "kein", "kain", "radi"], [5, 10, 1, 3], [["may", "kein", "kain", "radi"],["may", "kein", "brin", "deny"], ["kon", "kain", "may", "coni"]]))
print(solution(["kali", "mari", "don"],[11, 1, 55],[["kali", "mari", "don"], ["pony", "tom", "teddy"], ["con", "mona", "don"]]))
print(solution(["may", "kein", "kain", "radi"],[5, 10, 1, 3],[["may"],["kein", "deny", "may"], ["kon", "coni"]]))
๋์ ๋๋ฆฌ๋ฅผ ์ด์ฉํด ๊ฐ์ด ์์ผ๋ฉด ๋ํด์ฃผ๊ณ ์๋ค๋ฉด ๋์ด๊ฐ๋ค.