Bomb Kirby Running
Cat Life - GT-K
1284번 수도 요금 경쟁

2023. 4. 16. 21:33SWEA

Problem Solving - Level 2 - 수도 요금 경쟁

https://swexpertacademy.com/main/code/problem/problemDetail.do?problemLevel=2&contestProbId=AV189xUaI8UCFAZN&categoryId=AV189xUaI8UCFAZN&categoryType=CODE&problemTitle=&orderBy=FIRST_REG_DATETIME&selectCodeLang=ALL&select-1=2&pageSize=10&pageIndex=3 

#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
    int T,P,Q,R,S,W,result;
    cin>>T;
    
    for(int i=1;i<=T;i++)
    {
        cin>>P>>Q>>R>>S>>W;
        
        if(R>W)
        {
            int A=P*W;
            int B=Q;
            result=min(A,B);
        }
        
        else
        {
            int A=P*W;
            int B=Q+(W-R)*S;
            result=min(A,B);
        }
        
        cout<<"#"<<i<<" "<<result<<endl;
    }
    return 0;
}

'SWEA' 카테고리의 다른 글

1288번 새로운 불면증 치료법  (0) 2023.04.16
1285번 아름이의 돌 던지기  (0) 2023.04.16
1204번 최빈수 구하기  (0) 2023.04.16
2072번 홀수만 더하기  (0) 2023.03.23
2071번 평균값 구하기  (0) 2023.03.23