[SWEA] 1284 수도 요금 경쟁

김은서·2021년 9월 8일
0

SWEA

목록 보기
29/47

Python code

T = int(input())
for tc in range(1, T+1):
    a_price, b_fixed_price, b_limit, b_price, amount  = map(int, input().split())
    a = 0
    b = 0
    a = a_price * amount
    if amount <= b_limit:
        b = b_fixed_price
    else:
        b = b_fixed_price + b_price * (amount - b_limit)
    if a > b:
        print('#{} {}'.format(tc, b))
    else:
        print('#{} {}'.format(tc, a))
profile
Gracelog

0개의 댓글