CSE/baekjoon & swexpert
백준 그리디 5585 거스름돈
언제나 변함없이
2019. 4. 8. 19:29
반응형
import java.util.*;
public class main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int count = 0;
int pay = sc.nextInt();
int get = 1000-pay;
count += get/500;
get %= 500;
count += get/100;
get %= 100;
count += get/50;
get %= 50;
count += get/10;
get %= 10;
count += get/5;
get %= 5;
count += get;
System.out.println(count);
}
}
반응형