2008年7月29日星期二

ZJU/ZOJ 1877 Bridge 解题报告

题目大意是要n个人要过桥,过桥需要手电筒,可以两个人一起过,算慢的那个人的速度,如果还有人要过则需要一个人拿着手电筒回来,问全部人过完桥需要多长时间并给出过桥方案。

很经典的贪心问题(据说还是Microsoft的面试题?),先按速度进行排序。首先考虑人数多于3的情况,很明显只有两种选择最快的带最慢和次慢的组合或者最快和次快+最慢和次慢的组合,比较两者耗时来进行选择,一直处理到只剩下不多于3个人为止。此时的选择已经是唯一的了,对应不同的n处理即可。

3012992 2008-07-29 21:02:02 Accepted 1877 FPC 00:00.01 412K IwfWcf

5 条评论:

  1. hermes birkin, http://www.hermesbirkin.org/
    chanel outlet, http://www.chaneloutletstore.us.com/
    nike free uk, http://www.nikefreerunning.org.uk/
    ray ban sunglasses, http://www.raybansunglass.com.au/
    rolex watches, http://www.rolexwatches.in.net/
    ray ban sunglasses, http://www.ray-bansunglasses.eu.com/
    yoga pants, http://www.yogapants.us.com/
    beats headphones, http://www.beats-headphones.in.net/
    michael kors outlet, http://www.michaelkorsusa.us/
    pandora jewelry, http://www.pandora.eu.com/
    cheap ugg boots, http://www.cheapuggboots.net.co/
    air jordan shoes, http://www.airjordanshoes.us.org/
    louis vuitton outlet, http://www.louisvuittonus.us.com/
    ed hardy clothing, http://www.edhardy.us.com/
    replica handbags, http://www.replicahandbag.us.com/
    the north face outlet store, http://www.thenorthfaceoutletstores.org/
    tiffany jewellery, http://www.tiffanyjewelleryoutlets.co.uk/
    lebron james shoes, http://www.lebronjamesshoes.in.net/
    gucci handbags, http://www.guccihandbags-outlet.co.uk/
    true religion outlet, http://www.truereligionoutletstore.us.com/
    swarovski jewelry, http://www.swarovski.in.net/
    michael kors outlet, http://michaelkors.outletonlinestores.us.com/
    swarovski outlet, http://www.swarovski-outlet.co.uk/
    wedding dresses, http://www.weddingdressesoutlet.co.uk/
    louis vuitton handbags, http://www.louisvuittonhandbagsoutlet.co.uk/
    lebron james shoes, http://www.lebronjames.us.com/
    nike trainers, http://www.niketrainers.me.uk/
    kobe shoes, http://www.kobeshoes.us/
    cheap snapbacks, http://www.cheapsnapbacks.us.com/
    1003maoqiuyun

    回复删除

相关文章

 
Creative Commons License
除非另有声明,本网站采用知识共享署名-非商业性使用-相同方式共享 3.0 许可协议授权。