Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
Tags
- Tree
- 자바
- 구현
- dynamic programming
- Math
- array
- simulation
- Binary Search
- geometry
- 코딩테스트
- Counting
- implement
- 코테
- 파이썬
- Number Theory
- Stack
- sorting
- database
- hash table
- SQL
- Method
- greedy
- Matrix
- Data Structure
- two pointers
- string
- Class
- java
- Binary Tree
- bit manipulation
Archives
- Today
- Total
코린이의 소소한 공부노트
[프로그래머스/Lv.0] 옷가게 할인 받기 본문
1. Input
1) 구매한 옷의 가격 price
2. Output
1) 지불해야할 금액을 소수점 이하를 버린 정수로 반환
2) 10만원 이상 사면 5% 할인
3) 30만원 이상 사면 10% 할인
4) 50만원 이상 사면 20% 할인
3. Constraint
1) 10 <= price <= 1,000,000
2) price는 10원 단위로(1의 자리가 0) 주어진다.
4. Example
Input: price=150000 -> Output: 142500
5. Code
1) 첫 코드(2022/10/20)
if(price >= 500000)
return (int)(price * 0.8);
else if(price >= 300000)
return (int)(price * 0.9);
else if(price >= 100000)
return (int)(price * 0.95);
else
return price;
'코딩테스트 풀이 > JAVA' 카테고리의 다른 글
[프로그래머스/Lv.0] 나이 출력 (0) | 2022.10.20 |
---|---|
[프로그래머스/Lv.0] 아이스 아메리카노 (0) | 2022.10.20 |
[프로그래머스/Lv.0] 최빈값 구하기 (0) | 2022.10.19 |
[프로그래머스/Lv.0] 배열의 평균값 (0) | 2022.10.19 |
[프로그래머스/Lv.0] 피자 나눠 먹기 (3) (0) | 2022.10.19 |