본문 바로가기

[SWEA] - Python

[SWEA/D2] 1284 : 수도 요금 경쟁 python

https://swexpertacademy.com/main/code/problem/problemDetail.do

 

T = int(input())
for test_case in range(1, T + 1):
    P,Q,R,S,W = map(int,input().split())
    A = W*P
    B = Q
    if W>R:
        B += (W-R)*S
    print('#%d'%test_case,min(A,B))