SWEA

[SWEA] 수도 요금 경쟁

itsnot4me 2024. 10. 10. 16:55

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

 

SW Expert Academy

SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!

swexpertacademy.com

import java.util.Scanner;
import java.io.FileInputStream;


class Solution
{
	public static void main(String args[]) throws Exception
	{
		
		Scanner sc = new Scanner(System.in);
		int T;
		T=sc.nextInt();


		for(int test_case = 1; test_case <= T; test_case++)
		{
			int P = sc.nextInt(); int Q = sc.nextInt(); int R = sc.nextInt(); int S = sc.nextInt(); int W = sc.nextInt();
            int sumA = P*W;
            int sumB = 0;
            if(W<R)
            	 sumB += Q;
            else if(R<=W)
           		 sumB += Q+(W-R)*S;
            
            if(sumA>sumB)
                System.out.println("#" + test_case + " " + sumB);
            else if(sumB>=sumA)
                System.out.println("#" + test_case + " " + sumA);
			
		}
	}
}

 

댓글에 "D1으로" 가 가득하다

'SWEA' 카테고리의 다른 글

[SWEA] 백만 장자 프로젝트 (+오답)  (0) 2024.10.13
[SWEA] 최빈수 구하기  (0) 2024.10.10
[SWEA] 새로운 불면증 치료법  (1) 2024.10.10
[SWEA] 가랏! RC카!  (0) 2024.10.08
[SWEA] 간단한 압축 풀기  (0) 2024.10.06