|
-
Aug 21st, 2002, 04:03 PM
#1
Thread Starter
Junior Member
matching a currency amount to available denominations
Hi,
I have a problem, for which I'm looking for an algorithm. Given a limited set of currency denominations (bills only, so they are integer numbers) and a currency amount (this would be bills only as well, so it's an integer). I need to figure out whether the currency amount passed in can be broken down into the available denominations. If it can't be broken down into the available denominations I need to find the nearest amount which is greater than the given amount which can be broken down into the given denominations.
Here's an example:
Denominations (20,50,100,500,1000)
-------------------------
currency amount in question: 80
answer: yes it can be broken down into the available denominations (20x4)
-------------------------
currency amount in question: 70
answer: yes it can be broken down into the available denominations (20+50)
-------------------------
currency amount in question: 75
answer: no not it can not be broken down into the available denominations, the next greater value which can is 80 (20x4).
Thanks for any help.
Last edited by ChrisSte; Aug 21st, 2002 at 04:58 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|