Skip to content

Commit

Permalink
CT_266
Browse files Browse the repository at this point in the history
  • Loading branch information
Jade-Good committed Sep 29, 2024
1 parent ddc84b1 commit f39759a
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions BOJ/Java/src/B4/Boj_25704_출석이벤트.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,27 @@ public static void main(String[] args) throws IOException {

int N = Integer.parseInt(br.readLine());
int P = Integer.parseInt(br.readLine());
int min = Integer.MAX_VALUE;

if (N >= 5) {
min = Math.min(min, P - 500);
// 적용 가능한 할인 쿠폰을 계산
int finalPrice = P; // 할인 적용 후 가격

if (N >= 20) { // 25% 할인 쿠폰
finalPrice = Math.min(finalPrice, (int) (P * 0.75));
}
if (N >= 10) {
min = Math.min(min, (int) (P * 0.9));
if (N >= 15) { // 2,000원 할인 쿠폰
finalPrice = Math.min(finalPrice, P - 2000);
}
if (N >= 15) {
min = Math.min(min, P - 2000);
if (N >= 10) { // 10% 할인 쿠폰
finalPrice = Math.min(finalPrice, (int) (P * 0.9));
}
if (N >= 20) {
min = Math.min(min, (int) (P * 0.75));
if (N >= 5) { // 500원 할인 쿠폰
finalPrice = Math.min(finalPrice, P - 500);
}

bw.write(Integer.toString(min));
// 지불 금액이 0보다 작은 경우 0으로 설정
finalPrice = Math.max(finalPrice, 0);

bw.write(Integer.toString(finalPrice));
bw.flush();
}
}

0 comments on commit f39759a

Please sign in to comment.