티스토리 뷰
1284. 수도 요금 경쟁
import java.util.Scanner;
// 210130
// 1284. 수도 요금 경쟁
public class SWEA1284 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
for (int tc = 1; tc <= T; tc++) {
int P = sc.nextInt();
int Q = sc.nextInt();
int R = sc.nextInt();
int S = sc.nextInt();
int W = sc.nextInt();
int A = W * P;
int B;
if (W <= R) B = Q;
else B = Q + (W-R) * S;
int res = (A<B ? A : B);
// 출력
System.out.println("#" + tc + " " + res);
} // for
sc.close();
} // main
}
'코딩테스트 > SW Expert' 카테고리의 다른 글
[SWEA] 1989. 초심자의 회문 검사 (0) | 2021.01.30 |
---|---|
[SWEA] 2001. 파리 퇴치 (0) | 2021.01.30 |
[SWEA] 1954. 달팽이 숫자 (0) | 2021.01.30 |
[SWEA] 2007. 패턴 마디의 길이 (0) | 2021.01.29 |
[SWEA] 1926. 간단한 369게임 (0) | 2021.01.29 |
댓글