728x90
class Solution {
public int solution(int price) {
double answer = 0;
if(price>=100000&&price<300000) answer = price*0.95;
else if(price>=300000&&price<500000) answer = price*0.9;
else if(price>=500000)answer = price*0.8;
else answer = price;
return (int)answer;
}
}
조건을 잘 생각해서 넣어주자.
반응형
'CodingTest > Programmers' 카테고리의 다른 글
| Lv.0 모음제거 ** (0) | 2022.11.23 |
|---|---|
| Lv.0 문자열안에 문자열 (0) | 2022.11.22 |
| Lv.0 제곱수 판별하기 * (1) | 2022.11.22 |
| Lv.0 순서쌍의 개수 (0) | 2022.11.22 |
| Lv.0 자릿수 더하기 (0) | 2022.11.22 |
댓글