알고리즘

[알고리즘] 백준 14470 - 전자레인지 (C++)

blueberrysoda 2024. 9. 20. 23:52

[문제 링크] : https://www.acmicpc.net/problem/14470

#include <iostream>
using namespace std;

int main(){
    int A, B, C, D, E;
    cin >> A >> B >> C >> D >> E;
    if(A < 0){
        cout << abs(A) * C + D + B * E << "\n";
    }
    else{
        cout << (B - A) * E << "\n";
    }
    return 0;
}