青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

隨筆 - 87  文章 - 279  trackbacks - 0
<2007年6月>
272829303112
3456789
10111213141516
17181920212223
24252627282930
1234567

潛心看書研究!

常用鏈接

留言簿(19)

隨筆分類(81)

文章分類(89)

相冊

ACM OJ

My friends

搜索

  •  

積分與排名

  • 積分 - 221556
  • 排名 - 118

最新評論

閱讀排行榜

評論排行榜

PKU 3093 Margaritas on the River Walk
        先對輸入的數組排序,然后類似于01對a[i]做決策,核心代碼加了注釋:
         for (i=1; i<=n; i++) {
                 for (j=1; j<=maxsum; j++) {
                        if (j >= sum[i]) d[i][j] = 1; //j比sum[i]大,肯定這時候d[i][j]=1;
                        else {
                                d[i][j] = d[i-1][j];//不考慮a[i]
                                if (j-a[i]>=0) {//考慮a[i]
                                         if (d[i-1][j-a[i]] > 0) d[i][j] += d[i-1][j-a[i]];//把a[i]加進以前的選擇里面
                                         else d[i][j]++;//a[i]單獨作為一個選擇(這里需要先對a[i]排序,消除后效性)
                               }
                        }
                 }
         }

PKU 1037 A decorative fence
        先dp算出以i為起點的序列的個數,再組合數學
        td[n][i]和tu[n][i]分別表示個數為n,以i開始的上升和下降的序列個數
        易知:
        td[n][1] = 0;
        td[n][i] = sigma(tu[n-1][j], j從1..i-1)  = td[n][i-1] + tu[n-1][i-1] ;
        tu[n][i]  = td[n][n+i-1];

PKU 2677 Tour
        雙調歐幾里德旅行商問題(明顯階段dp)
        動態規劃方程 :d[i+1][i] = mint(d[i+1][i], d[i][j]+g[j][i+1]); 
                                      d[i+1][j] = mint(d[i+1][j], d[i][j]+g[i][i+1]);
                                       0<=j<i   

PKU 2288 Islands and Bridges
        集合DP
        狀態表示: d[i][j][k] (i為13為二進制表示點的狀態, j為當前節點, k為到達j的前驅節點)

posted on 2007-04-20 18:10 閱讀(2157) 評論(5)  編輯 收藏 引用 所屬分類: 算法&ACM

FeedBack:
# re: 對一些DP題目的小結 2007-04-22 08:56 byron
豪大牛,問一下,這是一些題目嗎????  回復  更多評論
  
# re: 對一些DP題目的小結 2007-04-24 00:52 
@byron
是pku上的題目,我菜菜啊。。。  回復  更多評論
  
# re: 對一些DP題目的小結 2007-04-26 18:59 oyjpart
呵呵 就聊上了啊 :)  回復  更多評論
  
# re: 對一些DP題目的小結 2007-06-30 22:55 姜雨生
Margaritas on the River Walk
Time Limit:1000MS Memory Limit:65536K
Total Submit:309 Accepted:132

Description


One of the more popular activities in San Antonio is to enjoy margaritas in the park along the river know as the River Walk. Margaritas may be purchased at many establishments along the River Walk from fancy hotels to Joe’s Taco and Margarita stand. (The problem is not to find out how Joe got a liquor license. That involves Texas politics and thus is much too difficult for an ACM contest problem.) The prices of the margaritas vary depending on the amount and quality of the ingredients and the ambience of the establishment. You have allocated a certain amount of money to sampling different margaritas.

Given the price of a single margarita (including applicable taxes and gratuities) at each of the various establishments and the amount allocated to sampling the margaritas, find out how many different maximal combinations, choosing at most one margarita from each establishment, you can purchase. A valid combination must have a total price no more than the allocated amount and the unused amount (allocated amount – total price) must be less than the price of any establishment that was not selected. (Otherwise you could add that establishment to the combination.)

For example, suppose you have $25 to spend and the prices (whole dollar amounts) are:

Vendor A B C D H J
Price 8 9 8 7 16 5

Then possible combinations (with their prices) are:

ABC(25), ABD(24), ABJ(22), ACD(23), ACJ(21), ADJ( 20), AH(24), BCD(24), BCJ(22), BDJ(21), BH(25), CDJ(20), CH(24), DH(23) and HJ(21).

Thus the total number of combinations is 15.


Input


The input begins with a line containing an integer value specifying the number of datasets that follow, N (1 ≤ N ≤ 1000). Each dataset starts with a line containing two integer values V and D representing the number of vendors (1 ≤ V ≤ 30) and the dollar amount to spend (1 ≤ D ≤ 1000) respectively. The two values will be separated by one or more spaces. The remainder of each dataset consists of one or more lines, each containing one or more integer values representing the cost of a margarita for each vendor. There will be a total of V cost values specified. The cost of a margarita is always at least one (1). Input values will be chosen so the result will fit in a 32 bit unsigned integer.


Output


For each problem instance, the output will be a single line containing the dataset number, followed by a single space and then the number of combinations for that problem instance.


Sample Input


2
6 25
8 9 8 7 16 5
30 250
1 2 3 4 5 6 7 8 9 10 11
12 13 14 15 16 17 18 19 20
21 22 23 24 25 26 27 28 29 30

Sample Output


1 15
2 16509438

Hint


Note: Some solution methods for this problem may be exponential in the number of vendors. For these methods, the time limit may be exceeded on problem instances with a large number of vendors such as the second example below.


Source
Greater New York 2006
  回復  更多評論
  
# re: 對一些DP題目的小結 2007-06-30 22:59 姜雨生
應該可以更加優化  回復  更多評論
  
青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
      <noscript id="pjuwb"></noscript>
            <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
              <dd id="pjuwb"></dd>
              <abbr id="pjuwb"></abbr>
              久久久天天操| 浪潮色综合久久天堂| 亚洲国产精品一区二区尤物区| 久久精品国产欧美亚洲人人爽| 国产亚洲欧美另类中文| 久久久一本精品99久久精品66| 午夜视黄欧洲亚洲| 国产日韩欧美成人| 欧美成人精品一区| 欧美激情二区三区| 亚洲一区二区三区涩| 香蕉成人久久| 亚洲激情欧美激情| 亚洲一区二区视频在线观看| 国产亚洲精品美女| 亚洲国产成人在线| 欧美性色视频在线| 麻豆精品传媒视频| 欧美精选午夜久久久乱码6080| 亚洲欧美999| 久久青草久久| 亚洲一区二区欧美日韩| 欧美一级淫片aaaaaaa视频| 在线观看亚洲专区| aa日韩免费精品视频一| 国内不卡一区二区三区| 亚洲欧洲一区| 极品日韩av| 99re66热这里只有精品3直播| 国产三级精品在线不卡| 亚洲国产日韩在线| 国产午夜精品在线观看| 亚洲精品黄网在线观看| 国产在线精品一区二区夜色| 亚洲精品一区二区三区婷婷月 | 欧美日韩天堂| 久久人人爽爽爽人久久久| 欧美日韩免费看| 美女网站在线免费欧美精品| 国产精品剧情在线亚洲| 亚洲国产精品999| 国产在线观看精品一区二区三区| 日韩视频在线一区二区三区| 在线免费不卡视频| 亚洲视频在线观看免费| 99精品99久久久久久宅男| 久久精品国产77777蜜臀| 先锋a资源在线看亚洲| 欧美精品一区二区三区在线看午夜| 久久精品天堂| 国产欧美日韩精品专区| 在线视频欧美精品| 国产精品99久久久久久www| 久热精品在线| 免费高清在线视频一区·| 国产日韩1区| 亚洲女优在线| 午夜精品久久久久久久蜜桃app | 国模精品一区二区三区色天香| 夜夜精品视频一区二区| 一本色道久久综合一区| 欧美刺激性大交免费视频| 欧美18av| 91久久久在线| 欧美另类人妖| 日韩一区二区精品| 亚洲视频www| 国产精品久久久久一区二区三区| 亚洲免费成人| 午夜在线成人av| 国产亚洲精品综合一区91| 欧美主播一区二区三区| 两个人的视频www国产精品| 激情成人综合网| 久久网站热最新地址| 欧美岛国激情| 99精品国产热久久91蜜凸| 欧美激情一区二区在线 | 欧美激情一区在线| 91久久综合亚洲鲁鲁五月天| 欧美黄色一区| 一区二区免费在线观看| 亚洲欧美另类在线观看| 国产亚洲欧美日韩精品| 久久久久久穴| 亚洲激情在线播放| 亚洲一区二区三区四区在线观看 | 国产伦精品一区二区三区在线观看 | 99re6这里只有精品视频在线观看| 欧美精品久久99久久在免费线| 一区二区三区回区在观看免费视频| 亚洲一级免费视频| 国产综合视频| 欧美国产三级| 香蕉久久一区二区不卡无毒影院| 美女成人午夜| 一区二区三区你懂的| 国产精品色午夜在线观看| 久久美女性网| 亚洲深夜福利| 欧美波霸影院| 性一交一乱一区二区洋洋av| 激情综合电影网| 国产精品wwwwww| 老司机精品福利视频| 亚洲主播在线播放| 亚洲国产成人午夜在线一区 | 一区二区三区在线高清| 欧美美女bb生活片| 欧美专区日韩视频| 一级成人国产| 欧美激情在线有限公司| 久久激情久久| 正在播放亚洲| 亚洲国产欧美在线人成| 国产色综合天天综合网| 欧美体内谢she精2性欧美| 久久综合99re88久久爱| 午夜精品理论片| 99国产精品久久久久久久久久| 久久午夜国产精品| 午夜在线精品| 亚洲免费视频一区二区| 亚洲精品社区| 亚洲电影免费观看高清| 国产三区精品| 国产嫩草一区二区三区在线观看 | 国产精品视频yy9099| 欧美精品久久久久久久久老牛影院 | 亚洲欧美在线一区二区| 亚洲卡通欧美制服中文| 欧美国产精品v| 久久久久久自在自线| 欧美伊人久久| 午夜精品久久久久久久| 亚洲一区二区三| 亚洲四色影视在线观看| 亚洲视频www| 亚洲视频精选| 在线天堂一区av电影| 一区二区欧美精品| 亚洲免费观看| 一区二区三区久久久| 亚洲欧洲视频在线| 亚洲精品一区二区三区99| 亚洲精品黄网在线观看| 亚洲九九精品| 一区二区高清在线观看| 亚洲午夜激情免费视频| 亚洲男人的天堂在线观看| 亚洲淫性视频| 欧美一区二区三区免费视频| 欧美中文字幕视频| 久久久久九九视频| 久久综合九色综合欧美就去吻| 蜜臀av一级做a爰片久久| 欧美激情精品久久久| 亚洲国产视频直播| 99这里只有精品| 亚洲一区激情| 欧美综合77777色婷婷| 久久久精品国产99久久精品芒果| 久久视频在线免费观看| 欧美激情精品久久久久久黑人| 欧美天堂亚洲电影院在线播放| 国产精品自在在线| 黑人巨大精品欧美一区二区小视频| 国产一区在线观看视频| 亚洲高清资源| av成人福利| 久久成人人人人精品欧| 欧美成人免费全部观看天天性色| 91久久夜色精品国产九色| 亚洲一区国产| 麻豆成人在线| 国产精品入口麻豆原神| 在线国产日韩| 午夜激情综合网| 欧美成年人网| 在线一区二区三区做爰视频网站| 久久国产精品电影| 欧美日韩亚洲91| 在线看国产日韩| 99视频超级精品| 久久亚洲免费| 亚洲夜间福利| 欧美精品 日韩| 黄色成人免费观看| 亚洲一区图片| 亚洲高清一二三区| 午夜精品在线| 欧美视频一区二区三区四区| 伊人久久大香线蕉综合热线| 亚洲在线视频观看| 欧美成人免费视频| 欧美中文在线观看国产| 国产精品成人一区二区| 亚洲精品国产精品久久清纯直播 | 日韩天堂av| 欧美/亚洲一区|