[백준] P5585

동민·2021년 3월 11일
0
import java.util.Scanner;

public class P5585 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int balance = 1000 - sc.nextInt(), answer = 0;
		int[] coin = { 500, 100, 50, 10, 5, 1 };
		for (int ele : coin) {
			answer += balance / ele;
			balance %= ele;
		}
		System.out.println(answer);
		sc.close();
	}
}
profile
BE Developer

0개의 댓글