본문 바로가기
Beakjoon&프로그래머스/파이썬

[백준/파이썬] 29575번 Игровой автомат

by 현장 2025. 4. 28.

-Code

n = int(input())

# 점수 얻는 숫자들 저장
jackpot = {}
for _ in range(n):
    c, w = map(int, input().split())
    jackpot[c] = w

# 결과 저장
res = 0

# 슬롯 돌리기
m = int(input())
for _ in range(m):
    num = int(input())
    # 숫자가 잭팟인 경우
    if num in jackpot:
        res += jackpot[num]
    res -= 10

print(res)