University of Calgary

perplexed banker

The Perplexed Banker
source: ccsc programming contest


A man went to a bank with $1000.00 in $1 dollar bills and 10 bags. He said, "Place this money , please, in the bags in such a way that if I call and ask for a certain number of dollars you can hand me over one or more bags, giving me the exact amount called for without opening any of the bags.
 
Write a program that will take as input an amount $1.00 - $1000.00 and print which bags (bag #X [contains $Y]) must be used to make up the amount.



Updated: August 10, 2005 10:17 AM