← Back to List

34183번: SUAPC 의자 준비하기 ↗

Solutions

Python 3
122 B | 122 chars
N, M, A, B = map(int, input().split())

need = max(0, 3 * N - M)

if need > 0:
    print(A * need + B)
else:
    print(0)