原创  关于微软的摔XBOX的问题 收藏

原始问题如下:

   You   have   been   given   2   special,   extremely   rugged   Xboxes.   You   are   in   an   office   building   that   is   100   stories   high.   Using   the   fewest   possible   number   of   drops   from   windows   in   your   office   building,   determine   the   highest   floor   you   can   drop   an   Xbox   from   and   have   it   survive:   for   example,   they   might   be   able   to   take   the   drop   from   the   30th   floor,   but   not   the   31st.   You   can   break   both   Xboxes   in   your   search.   State   the   worst   case   number   of   drops   needed   and   explain   how   you   arrived   at   that   answer.  
   
  你在一幢100层的办公楼里上班,现在给你两台xbox(已经特意捆绑包扎好),要求你用尽可能少的试摔次数来判断xbox摔不坏的最高楼层层数。比方说,从30层丢下来没问题,但从31层丢下来就不保了。在摸索过程中,允许把两台xbox都砸烂。  
   
  注:100层内必定摔坏(即摔坏的最大层数<=100层),不是脑筋急转弯,而且有且只有2台XBox   
    
详细解释你的答案和思路。

我的答案:

这个问题可以倒推的  
  假定最佳次数是N  
   
  第一次就在N,   如果有问题剩余的用第二个盒子N-1次搞定  
  第二次就在     N+N-1   处开始,   有问题第二个盒子N-2次搞定  
  第三次     在2N-1+n-2=3n-3处开始,有问题第二个盒子n-3次搞定  
  ...  
  第N次     在N*N-N*(N-1)/2处开始  
  N*N-N*(N-1)/2   =   N*(N+1)/2     >   100  
  N   =   14  
   
  因此排列是:  
  14   27   39   50   60   69   78   85   91   96   100   103   105       106  
      13   12   11   10   9     8     7     6     5     4       3       2         1

更多的网友交流在:

http://topic.csdn.net/t/20050204/06/3774532.html 

发表于 @ 2007年02月13日 10:44:00 | 评论( loading... ) | 编辑| 举报| 收藏

旧一篇:突然发现,我给csdn的贡献很大啊!  | 新一篇:装修设计软件

  • 发表评论
  • 评论内容:
  •  
Copyright © happy__888
Powered by CSDN Blog