import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main5585 {
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int N = Integer.parseInt(br.readLine()); //지불할 돈 N
N = 1000 - N;
int coinType[] = {500, 100, 50, 10 ,5, 1};
int cnt = 0;
for(int i=0; i<coinType.length; i++){
cnt += N/coinType[i];
N %= coinType[i];
}
System.out.println(cnt);
}
}
'휴지통 > 알고리즘 & 자료구조' 카테고리의 다른 글
백준 11047 (0) | 2021.11.02 |
---|---|
그리디 (Greedy) (0) | 2021.11.01 |
복잡도 (0) | 2021.11.01 |
백준 1107 (0) | 2021.09.30 |
백준 1476 (0) | 2021.09.25 |