The Bus Card
InterviewTime limit1sMemory limit1024 MB
Given a travel amount K in SEK, find the fewest card top-ups of 100, 200, or 500 SEK that cover at least K.
Problem
You are going to purchase a bus card. It is a refillable card into which cash can be deposited, and then used to ride the bus until the money runs out. You know that you plan to travel for Swedish crowns (SEK). Charging the card takes some time, since you can only charge it with , , or SEK at a time.
You are in a hurry, so you want to make as few transactions as possible, but you never insert more money than necessary. If you are to travel for SEK, you should load , then , and then SEK. If you are traveling for SEK, you should first load , and then SEK twice. SEK is wasted, but that is still the best option.
Compute the minimum number of transactions necessary.
Input
The input consists of the integer (), the amount you will travel for.
Output
Output a single integer, the number of transactions necessary.