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

隨筆 - 87  文章 - 279  trackbacks - 0
<2025年12月>
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910

潛心看書研究!

常用鏈接

留言簿(19)

隨筆分類(81)

文章分類(89)

相冊

ACM OJ

My friends

搜索

  •  

積分與排名

  • 積分 - 221253
  • 排名 - 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>
              亚洲高清视频的网址| 伊人激情综合| 久久久久免费| 欧美日韩精品是欧美日韩精品| 久久国内精品视频| 欧美日韩亚洲成人| 蜜臀va亚洲va欧美va天堂 | 久久精品亚洲一区二区三区浴池| 亚洲精品看片| 香蕉久久夜色精品国产使用方法| 一区二区三区视频在线播放| 久久婷婷激情| 久久久噜噜噜| 国产人成一区二区三区影院| 99精品免费网| 亚洲精品一级| 欧美大片在线观看一区二区| 欧美阿v一级看视频| 国产亚洲毛片在线| 午夜久久资源| 欧美中文字幕第一页| 国产精品人人爽人人做我的可爱| 亚洲人久久久| 最新国产拍偷乱拍精品| 久久人91精品久久久久久不卡| 久久久噜噜噜久久中文字幕色伊伊| 欧美日韩一区自拍| 日韩一区二区电影网| 亚洲欧洲精品一区| 免费av成人在线| 欧美大片免费久久精品三p | 欧美综合77777色婷婷| 国产精品xvideos88| 亚洲精品国产视频| 99re热这里只有精品视频| 欧美精品色网| 一区二区三区日韩| 亚洲欧美日韩国产另类专区| 国产精品一区免费视频| 亚洲综合大片69999| 久久精品国产清高在天天线| 国产欧美日韩在线观看| 欧美亚洲三区| 免费观看不卡av| 亚洲人妖在线| 欧美日韩国产精品一卡| 夜夜夜久久久| 性色一区二区三区| 国语对白精品一区二区| 老司机免费视频一区二区| 欧美激情四色 | 最新亚洲激情| 亚洲一区二区三区四区中文| 国产精品视频九色porn| 欧美一区二区三区精品| 欧美jizz19性欧美| 一区二区三区四区五区精品视频| 国产精品hd| 欧美中文字幕在线视频| 亚洲成在人线av| 99在线精品视频| 国产精品sm| 久久精品亚洲精品| 亚洲日本欧美在线| 欧美一区二区三区日韩| 亚洲激情精品| 国产精品视频xxxx| 欧美高清hd18日本| 亚洲欧美日韩国产中文在线| 免费h精品视频在线播放| 中文亚洲欧美| 国内精品久久久久影院薰衣草| 欧美大秀在线观看| 西西人体一区二区| 亚洲欧洲在线观看| 欧美一二三区精品| 亚洲精品久久久久久下一站 | 欧美高清在线视频| 性做久久久久久| 亚洲美女毛片| 欧美激情国产精品| 久久久久久免费| 亚洲一区欧美一区| 亚洲国产美女精品久久久久∴| 国产精品日韩二区| 欧美日本国产| 久久在线视频| 欧美在线电影| 亚洲欧美日韩国产中文在线| 亚洲福利视频三区| 久久夜精品va视频免费观看| 午夜精品福利在线观看| 亚洲免费观看视频| 亚洲福利视频网| 韩国av一区| 国产伪娘ts一区| 国产精品午夜电影| 麻豆精品视频| 久久精品国产久精国产爱 | 亚洲靠逼com| 欧美激情按摩在线| 美腿丝袜亚洲色图| 久久免费少妇高潮久久精品99| 午夜激情综合网| 亚洲一区二区免费视频| 一区二区精品在线观看| 亚洲区一区二区三区| 亚洲国产美女精品久久久久∴| 狠狠综合久久av一区二区小说| 国产手机视频一区二区| 国产精品综合视频| 国产精品久久毛片a| 国产精品激情偷乱一区二区∴| 欧美激情一区二区三区蜜桃视频| 久久久精彩视频| 欧美在线视频免费播放| 性做久久久久久久久| 亚洲欧美日韩精品久久奇米色影视 | 久久精品电影| 久久精品人人爽| 久久三级视频| 久久亚洲风情| 欧美专区第一页| 久久久久久亚洲精品中文字幕| 久久精品一区二区国产| 久久久久久久欧美精品| 老司机精品视频网站| 欧美日本高清一区| 国产精品va在线播放| 国产精品视频免费观看| 国产欧美日本在线| 国产香蕉97碰碰久久人人| 伊人成人网在线看| 亚洲国产第一页| 亚洲激情女人| 日韩视频久久| 午夜免费电影一区在线观看| 久久久久久电影| 免费不卡在线观看av| 91久久在线观看| 亚洲综合丁香| 久久九九电影| 久久夜色精品国产亚洲aⅴ | 欧美日韩国产综合网| 欧美连裤袜在线视频| 国产精品亚洲产品| 狠狠网亚洲精品| 日韩五码在线| 久久精品国产99精品国产亚洲性色 | 一区二区在线观看av| 亚洲欧洲综合另类| 亚洲精品乱码久久久久久蜜桃麻豆| 亚洲精品中文字幕在线| 亚洲永久精品国产| 久久久久久综合| 在线亚洲+欧美+日本专区| 久久久激情视频| 国产精品啊啊啊| 1204国产成人精品视频| 亚洲综合色自拍一区| 噜噜噜91成人网| 亚洲视频观看| 欧美大片在线观看| 国产精品自拍小视频| 亚洲精品影视在线观看| 午夜免费日韩视频| 91久久国产综合久久| 欧美一区二区三区在线| 欧美日韩国产精品一区二区亚洲| 国产欧美一区在线| 9久re热视频在线精品| 久久人人97超碰精品888| 夜夜爽www精品| 欧美电影在线播放| 伊人成年综合电影网| 午夜视频在线观看一区二区| 亚洲国产天堂久久综合网| 久久精品亚洲| 国产免费成人av| 亚洲一区日韩| 亚洲福利精品| 欧美一区二区三区在线视频| 欧美日韩一区二区三| 亚洲精品免费在线播放| 美女视频网站黄色亚洲| 欧美一区二区三区久久精品茉莉花 | 欧美专区中文字幕| 欧美视频不卡中文| 日韩天堂av| 亚洲狠狠婷婷| 欧美刺激性大交免费视频| 欧美先锋影音| 亚洲久色影视| 亚洲人成亚洲人成在线观看图片| 六月天综合网| 亚洲精品人人| 亚洲激情电影在线| 欧美aaa级| 夜夜嗨av色综合久久久综合网| 亚洲国产导航|