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
- 문제해결
- greedy
- BOJ
- 문제풀이
- 러닝일지
- 운동기록
- dfs
- 시뮬레이션
- BFS
- 코딩테스트
- 건강
- COS PRO
- 알고리즘
- SQL
- DP
- math
- 자바
- 투포인터
- 코테
- 프로그래머스
- SWEA
- 문자열
- 이분탐색
- oracle
- priorityqueue
- MySQL
- Java
- binary search
- db
- 백준
Archives
- Today
- Total
슈콩
COS PRO 1급 JAVA 거스름돈 구하기 본문


[소스 코드]
class Main {
public int solution(int money) {
int coin[] = {10, 50, 100, 500, 1000, 5000, 10000, 50000};
int counter = 0;
int idx = coin.length - 1;
while (money > 0){
counter += money / coin[idx];
money %= coin[idx];
idx -= 1;
}
return counter;
}
}