public class Application{
public static void main(String[] args) {
final int W500 = 500;
final int W100 = 100;
final int W50 = 50;
final int W10 = 10;
final int LIMIT = 5000;
int i;
Scanner sc = new Scanner(System.in);
System.out.print("가격을 입력하세요 : ");
i = sc.nextInt();
if(i<=5000){
if(i%W500 < LIMIT ){
System.out.println("500원짜리" + i/W500 + "개");
i = i % W500;
}
if(i%W100 < LIMIT){
System.out.println("100원짜리" + i/W100 + "개");
i = i % W100;
}
if(i%W50 < LIMIT){
System.out.println("50원짜리" + i/W50 + "개");
i = i % W50;
}
if(i%W10 < LIMIT){
System.out.println("10원짜리" + i/W10 + "개");
i = i % W10;
}
}
else
{
System.out.println("한도를 초과했습니다.");
}
}
}