← Back to List

10707번: 수도요금 ↗

Solutions

C++14
197 B | 197 chars
#include <iostream>
using namespace std;
int A,B,C,D,P;
int a,b;
int main()
{
    cin>>A>>B>>C>>D>>P;
    a=A*P;
    if(P-C>0)
    {
        b=(P-C)*D+B;
    }
    else b=B;
    cout<< (a>b?b:a);
}