You are given 1000 one dollar bills and 10 envelopes. Put the bills
into the envelopes in such a way that someone can ask you for any
amount of money from $1 to $1000 (examples - $532, $619, $88, etc.)
and you can give it to them through a combination of the envelopes.
解
Using binary expressions:
1, 2, 4, 8, 16, 32, 64, 128, 256, 489 (which is 1000 – (1+2+…+256)).
For each integer between 1 to 511 (=2^9-1), its binary expression maps it to a unique combination of 1, 2, …, 256 (=2^8). With an envelop of 489 dollars, we can get every integer from 1 to 1000.