设为首页 加入收藏

TOP

HDU 2126 Buy the souvenirs(一)
2015-07-20 18:02:26 来源: 作者: 【 】 浏览:9
Tags:HDU 2126 Buy the souvenirs

Buy the souvenirs

Time Limit: 10000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 927 Accepted Submission(s): 319


Problem Description When the winter holiday comes, a lot of people will have a trip. Generally, there are a lot of souvenirs to sell, and sometimes the travelers will buy some ones with pleasure. Not only can they give the souvenirs to their friends and families as gifts, but also can the souvenirs leave them good recollections. All in all, the prices of souvenirs are not very dear, and the souvenirs are also very lovable and interesting. But the money the people have is under the control. They can’t buy a lot, but only a few. So after they admire all the souvenirs, they decide to buy some ones, and they have many combinations to select, but there are no two ones with the same kind in any combination. Now there is a blank written by the names and prices of the souvenirs, as a top coder all around the world, you should calculate how many selections you have, and any selection owns the most kinds of different souvenirs. For instance:

\


And you have only 7 RMB, this time you can select any combination with 3 kinds of souvenirs at mZ??http://www.2cto.com/kf/ware/vc/" target="_blank" class="keylink">vc3QsIHNvIHRoZSBzZWxlY3Rpb25zIG9mIDMga2luZHMgb2Ygc291dmVuaXJzIGFyZSBBQkMgKDYpLCBBQkQgKDcpLiBCdXQgaWYgeW91IGhhdmUgOCBSTUIsIHRoZSBzZWxlY3Rpb25zIHdpdGggdGhlIG1vc3Qga2luZHMgb2Ygc291dmVuaXJzIGFyZSBBQkMgKDYpLCBBQkQgKDcpLAogQUNEICg4KSwgYW5kIGlmIHlvdSBoYXZlIDEwIFJNQiwgdGhlcmUgaXMgb25seSBvbmUgc2VsZWN0aW9uIHdpdGggdGhlIG1vc3Qga2luZHMgb2Ygc291dmVuaXJzIHRvIHlvdTogQUJDRCAoMTApLjxicj4KCiAKPHA+PGJyPgo8L3A+CklucHV0CkZvciB0aGUgZmlyc3QgbGluZSwgdGhlcmUgaXMgYSBUIG1lYW5zIHRoZSBudW1iZXIgY2FzZXMsIHRoZW4gVCBjYXNlcyBmb2xsb3cuPGJyPgpJbiBlYWNoI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 7
1 2 3 4

4 0
1 2 3 4


Sample Output
You have 2 selection(s) to buy with 3 kind(s) of souvenirs.
Sorry, you can't buy anything.


Author wangye


Source HDU 2007-10 Programming Contest


Recommend 威士忌


题意:求最优方案数。

具体贴个别人的博客,我就是看这个学哒。

http://blog.csdn.net/wumuzi520/article/details/7019131

AC代码:

#include 
  
   
#include 
   
     #include 
    
      #include 
     
       #include 
      
        #include 
       
         u
首页 上一页 1 2 下一页 尾页 1/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇UVa 1585 Score(水) 下一篇CodeForces 283C Coin Troubles ..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: