문제 링크 : https://www.swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV189xUaI8UCFAZN


문제의 저작권은 SW Expert Academy에 있습니다.



#include <iostream>
 
using namespace std;
 
int main(void) {
    int T, P, Q, R, S, W;
    cin >> T;
 
    for(int t_case=0; t_case<T; t_case++) {
        int Aprice, Bprice;
        cin >> P >> Q >> R >> S >> W;
 
        Aprice = W * P;
 
        if(W <= R)
            Bprice = Q;
        else {
            Bprice = Q + (W-R) * S;
        }
 
        cout << "#" << t_case+1 << " " << (Aprice<Bprice ? Aprice : Bprice) << "\n";
    }
 
    return 0;
}
cs

+ Recent posts