Yuanyuan
個人資料 | email |
posted 02-27-99 6:34 AM PT (US)
I have heard these from my classmates. They told me the questions were from a MS programming contest. (1) In a text file there's 999999 numbers counting from one to one million except for one unknown number missing. The numbers are stored in random order. What's the most efficient way to find the missing number? (2) There are two rooms. One room has three bulbs. The other room has three switches that control the bulbs in the first room. You're only allowed to go into each room once, of the order you preferred. When you are in one room, you can't see what happens in the other room. How do identify which switch controls which bulb for all three switch-bulb pair? |
|
dreamincloud
個人資料 | email |
posted 02-27-99 10:05 AM PT (US)
問題(1):既然是MS的問題, 那麼就用EXCEL來解決. 假設所有數字是用空格分開, 如: 123 456 789 是
一至一百萬的總和是 (1+1000000)*1000000/2
至於第二條, 由於我聽過答案, 就留給其他站友好
|
|
Lazy Snake
個人資料 | email |
posted 02-27-99 12:23 PM PT (US)
Switch the first one on and leave the other two off for a reasonably long period of time. Then turn the first one off and turn the second on, and go to the bulb room. The bulb which is on corresponds to the second switch. The bulb which is off and warm corresponds to the first switch. The bulb which is off and cold corresponds to the third switch. |
|
Bottle
個人資料 | email |
posted 03-06-99 4:04 AM PT (US)
遊雲和蛇蛇好聰明ㄚ~~~~~~~~~` 不像壺壺腦袋空空.... |
|
【 寫信給過兒 | 超級無敵IQ題 | 超級無敵IQ題精華討論主頁】 |