1000個蘋果10個箱子
這問題是取自李開復的新書"做21世紀的人才"。
我有1000個蘋果,與10個箱子。有沒有可能將所有蘋果其分配到箱子中,當你要任何數量的蘋果時,我都可以給你一個或數個箱子,其蘋果總數正好是你要的。而我不需要再將蘋果拿出或拿進箱子?
提示:用二進位去思考
ANS:
[
-
1st box - 1 apples - 2^0
- 2nd box- 2 apples - 2^1
- 3th box - 4 apples - 2^2
- 4th box - 8 apples - 2^3
- 5th box - 16 apples - 2^4
- 6th box - 32 apples - 2^5
- 7th box - 64 apples - 2^6
- 8th box - 128 apples - 2^7
- 9th box - 256 apples - 2^8
- 10th box - 489 apples - 1000 - (2^9-1)
]
如果你懂二進位,應該不難。這個觀念應該都有,只是換了個方法問問題。
2 迴響 |
0 引用



500,250,125,63,31,16,8,4,2,1
500,250,125,62,32,16,8,4,2,1
500,250,124,63,32,16,8,4,2,1
500,250,123,64,32,16,8,4,2,1
500,249,126,63,31,16,8,4,2,1
500,249,126,62,32,16,8,4,2,1
500,249,125,63,32,16,8,4,2,1
500,249,124,64,32,16,8,4,2,1
500,248,126,63,32,16,8,4,2,1
500,248,125,64,32,16,8,4,2,1
500,247,127,63,32,16,8,4,2,1
500,247,126,64,32,16,8,4,2,1
500,246,127,64,32,16,8,4,2,1
500,245,128,64,32,16,8,4,2,1
499,251,125,63,31,16,8,4,2,1
499,251,125,62,32,16,8,4,2,1
499,251,124,63,32,16,8,4,2,1
499,251,123,64,32,16,8,4,2,1
499,250,126,63,31,16,8,4,2,1
499,250,126,62,32,16,8,4,2,1
499,250,125,63,32,16,8,4,2,1
499,250,124,64,32,16,8,4,2,1
499,249,126,63,32,16,8,4,2,1
499,249,125,64,32,16,8,4,2,1
499,248,127,63,32,16,8,4,2,1
499,248,126,64,32,16,8,4,2,1
499,247,127,64,32,16,8,4,2,1
499,246,128,64,32,16,8,4,2,1
498,251,126,63,31,16,8,4,2,1
498,251,126,62,32,16,8,4,2,1
498,251,125,63,32,16,8,4,2,1
498,251,124,64,32,16,8,4,2,1
498,250,126,63,32,16,8,4,2,1
498,250,125,64,32,16,8,4,2,1
498,249,127,63,32,16,8,4,2,1
498,249,126,64,32,16,8,4,2,1
498,248,127,64,32,16,8,4,2,1
498,247,128,64,32,16,8,4,2,1
497,252,126,63,31,16,8,4,2,1
497,252,126,62,32,16,8,4,2,1
497,252,125,63,32,16,8,4,2,1
497,252,124,64,32,16,8,4,2,1
497,251,126,63,32,16,8,4,2,1
497,251,125,64,32,16,8,4,2,1
497,250,127,63,32,16,8,4,2,1
497,250,126,64,32,16,8,4,2,1
497,249,127,64,32,16,8,4,2,1
497,248,128,64,32,16,8,4,2,1
496,252,126,63,32,16,8,4,2,1
496,252,125,64,32,16,8,4,2,1
496,251,127,63,32,16,8,4,2,1
496,251,126,64,32,16,8,4,2,1
496,250,127,64,32,16,8,4,2,1
496,249,128,64,32,16,8,4,2,1
495,253,126,63,32,16,8,4,2,1
495,253,125,64,32,16,8,4,2,1
495,252,127,63,32,16,8,4,2,1
495,252,126,64,32,16,8,4,2,1
495,251,127,64,32,16,8,4,2,1
495,250,128,64,32,16,8,4,2,1
494,253,127,63,32,16,8,4,2,1
494,253,126,64,32,16,8,4,2,1
494,252,127,64,32,16,8,4,2,1
494,251,128,64,32,16,8,4,2,1
493,254,127,63,32,16,8,4,2,1
493,254,126,64,32,16,8,4,2,1
493,253,127,64,32,16,8,4,2,1
493,252,128,64,32,16,8,4,2,1
492,254,127,64,32,16,8,4,2,1
492,253,128,64,32,16,8,4,2,1
491,255,127,64,32,16,8,4,2,1
491,254,128,64,32,16,8,4,2,1
490,255,128,64,32,16,8,4,2,1
489,256,128,64,32,16,8,4,2,1
作者 路人 — 08 六月 2007, 11:10