决仕~上班族 » 日志 » 05·07 An IQ question
05·07 An IQ question
jazz 发表于 2007-05-07 15:03:32
The question is:
Four men crossing the bridge
Four men travelling together arrive at a bridge after dark and wish to cross. The bridge is narrow and they decide that they must use a flashlight to cross. They have a single flashlight. Unfortunately, the bridge will only stand the weight of two men at a time. A crossing party, either 1 or 2 people, must have the flashlight with them. The flashlight can be walked back and forth, but it cannot be thrown. Each man walks at a different speed, and any pair crossing must cross at the slower man's pace. The four different men can cross (one way) in the following time:
1 minute
2 minutes
5 minutes
10 minutes
Can all men cross in 17 minutes? What is the minimum time needed for all four men to cross the bridge? How would you prove that?
This question is quite tricky. I saw it from internet. It was an interview question. Actually, all men can cross within 17 minutes. The strategy is like this:
Notate 1minute A, 2 minutes B, 5 minutes C and 10minutes D.
Now, first, A and B cross the bridge and it costs 2 minutes. Then, A crosses back, and it costs 1 minutes. And C and D cross the bridge and it costs 10 minutes and now the total time is 13 minutes. At this moment, B crosses back and then come back with A and it costs 4 minutes as a whole. So the total time interval is 17 minutes.
Another question is about C/C++ is :
print the interger from 1 to 1000 without using 'for' or 'while' and so on, neither using recursive.
Four men crossing the bridge
Four men travelling together arrive at a bridge after dark and wish to cross. The bridge is narrow and they decide that they must use a flashlight to cross. They have a single flashlight. Unfortunately, the bridge will only stand the weight of two men at a time. A crossing party, either 1 or 2 people, must have the flashlight with them. The flashlight can be walked back and forth, but it cannot be thrown. Each man walks at a different speed, and any pair crossing must cross at the slower man's pace. The four different men can cross (one way) in the following time:
1 minute
2 minutes
5 minutes
10 minutes
Can all men cross in 17 minutes? What is the minimum time needed for all four men to cross the bridge? How would you prove that?
This question is quite tricky. I saw it from internet. It was an interview question. Actually, all men can cross within 17 minutes. The strategy is like this:
Notate 1minute A, 2 minutes B, 5 minutes C and 10minutes D.
Now, first, A and B cross the bridge and it costs 2 minutes. Then, A crosses back, and it costs 1 minutes. And C and D cross the bridge and it costs 10 minutes and now the total time is 13 minutes. At this moment, B crosses back and then come back with A and it costs 4 minutes as a whole. So the total time interval is 17 minutes.
Another question is about C/C++ is :
print the interger from 1 to 1000 without using 'for' or 'while' and so on, neither using recursive.
相关日志:
- » 当阿Π的IQ高达117后……
- » 为什么我这么热衷于IQ测试?
- » 若有若无...
- » IQ测试
- » 啊·感悟~
收藏:
QQ书签
del.icio.us
订阅:
Google
抓虾
