1284번 수도 요금 경쟁
2023. 4. 16. 21:33ㆍSWEA
Problem Solving - Level 2 - 수도 요금 경쟁
#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 |