class Solution {
public int solution(int price) {
int answer = 0;
if(price>=500000) answer=(int)(price*0.8);
else if(price>=300000) answer=(int)(price*0.9);
else if(price>=100000) answer=(int)(price*0.95);
else answer=price;
return answer;
}
}
처음에 30만원을 먼저 써서 틀렸습니다.
'코딩테스트 > lv0' 카테고리의 다른 글
[프로그래머스 코딩테스트]java Lv.0 모음 제거 (0) | 2024.07.09 |
---|---|
[프로그래머스 코딩테스트]java Lv.0 순서쌍의 개수 (0) | 2024.07.09 |
[프로그래머스 코딩테스트] java Lv.0 배열의 평균값 (0) | 2024.07.09 |
[프로그래머스 코딩테스트] java Lv.0 피자 나눠먹기(1) (0) | 2024.07.09 |
[프로그래머스 코딩테스트] java Lv.0 창고정리(PCCE 8번) (0) | 2024.07.05 |