haju__log

[python][SWEA][D2] 1284. 수도 요금 경쟁 본문

SWEA

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

haju 2023. 5. 18. 14:01

https://swexpertacademy.com/main/code/problem/problemDetail.do?problemLevel=2&problemLevel=3&contestProbId=AV189xUaI8UCFAZN&categoryId=AV189xUaI8UCFAZN&categoryType=CODE&problemTitle=&orderBy=PASS_RATE&selectCodeLang=PYTHON&select-1=3&pageSize=10&pageIndex=2 

 

SW Expert Academy

SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!

swexpertacademy.com

 

T=int(input())

for test_case in range(1,T+1):
    p,q,r,s,w=map(int,input().split())
    a=0
    b=0
    #a 요금
    a=p*w

    #b 요금
    if w<=r:
        b=q
    else:
        w-=r
        b=w*s+q

    print("#%d %d" %(test_case,min(a,b)))