[D2] 1284 - 수도 요금 경쟁알고리즘/SWEA2023. 8. 14. 19:42
Table of Contents
package SWEA;
import java.util.Scanner;
public class Solution1284 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
for(int test_case=1; test_case<=T; test_case++) {
int A; //A회사
int B; //B회사
int P; //A사의 L당 요금
int Q; //B사의 기본요금
int R; //S를 정하는 월간사용량 기준
int S; //R을 초과할 때 추가요금
int W; //종민이의 사용량
P = sc.nextInt();
Q = sc.nextInt();
R = sc.nextInt();
S = sc.nextInt();
W = sc.nextInt();
A = W * P;
B = W > R ? Q + (W - R) * S : Q;
System.out.printf("#%d %d\n",test_case,A<B ? A : B);
}
}
}
728x90
'알고리즘 > SWEA' 카테고리의 다른 글
[D2] 1288 - 새로운 불면증 치료법 (0) | 2023.08.14 |
---|---|
[D2] 1204 - 최빈수 구하기 (0) | 2023.08.14 |
[D1] 2056 - 연월일 달력 (0) | 2023.08.12 |
[D1] 2058 - 자릿수 더하기 (0) | 2023.08.12 |
[D1] 2063 - 중간값 찾기 (0) | 2023.08.12 |
@leegeonwoo :: geonwoo
포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!