본문 바로가기

Programming [Python]/백준 알고리즘 솔루션

#239 백준 파이썬 [9325] 얼마?

https://www.acmicpc.net/problem/9325

 

Python Code

T = int(input())

for _ in range(T):
    s = int(input())
    n = int(input())
    price = s
    
    for _ in range(n):
        q, p = map(int, input().split())
        price += q * p
        
    print(price)