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

隨筆 - 87  文章 - 279  trackbacks - 0
<2025年9月>
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011

潛心看書研究!

常用鏈接

留言簿(19)

隨筆分類(81)

文章分類(89)

相冊

ACM OJ

My friends

搜索

  •  

積分與排名

  • 積分 - 219405
  • 排名 - 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 閱讀(2141) 評論(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在看黑人| 国产精品成人久久久久| 欧美承认网站| 欧美jjzz| 欧美激情亚洲另类| 亚洲精品美女免费| 一区二区精品在线| 国产一区二区av| 欧美黑人在线观看| 欧美日韩一区三区| 久久久精品一品道一区| 久久综合影音| 美女成人午夜| 亚洲一区二区三区精品在线| 最新国产の精品合集bt伙计| 亚洲乱亚洲高清| 国产精品xxx在线观看www| 欧美一级久久久久久久大片| 久久狠狠婷婷| 日韩视频一区| 亚洲免费在线电影| 亚洲高清网站| 一区二区三区四区国产精品| 国产亚洲欧美激情| 亚洲精品欧美在线| 国产欧美不卡| 亚洲三级影片| 韩日精品视频| 一区二区三区免费网站| 精品88久久久久88久久久| 亚洲电影免费观看高清| 国产麻豆成人精品| 最新国产乱人伦偷精品免费网站 | 怡红院精品视频在线观看极品| 欧美福利影院| 国产一区二区成人久久免费影院| 亚洲国产一区二区三区在线播 | 亚洲一区二区三区久久| 性欧美8khd高清极品| 亚洲巨乳在线| 久久久水蜜桃av免费网站| 午夜久久资源| 欧美亚一区二区| 亚洲日本黄色| 伊人成人开心激情综合网| 亚洲欧美不卡| 亚洲一区视频在线观看视频| 欧美高清视频在线| 欧美国产第二页| 一区二区亚洲精品国产| 欧美国产一区二区三区激情无套| 鲁大师影院一区二区三区| 亚洲久久在线| 久久综合九色欧美综合狠狠| 国产精品羞羞答答xxdd| 亚洲国产精品第一区二区三区| 国产精品人人做人人爽人人添| 亚洲黄色一区| 在线国产精品一区| 欧美影院成人| 久久久免费精品视频| 国产女同一区二区| 亚洲综合丁香| 午夜在线观看欧美| 国产精品www994| 欧美福利视频网站| 欧美在线免费观看亚洲| 久久久综合网站| 麻豆免费精品视频| 宅男噜噜噜66国产日韩在线观看| 久久激情五月激情| 欧美一区二区三区四区高清| 欧美性大战xxxxx久久久| 一区二区高清在线观看| 亚洲午夜久久久久久久久电影院 | 亚洲精品在线一区二区| 久久综合中文| 亚洲福利专区| 亚洲美洲欧洲综合国产一区| 欧美插天视频在线播放| 亚洲看片网站| 欧美一区二区三区免费视频| 国产欧美日韩免费| 久久精品视频网| 欧美日韩国产首页在线观看| 久久久久久久综合色一本| 国产精品久久久久影院亚瑟| 中日韩在线视频| 另类酷文…触手系列精品集v1小说| 久久精品99国产精品日本| 在线不卡中文字幕| 久久久精品国产一区二区三区| 欧美第十八页| 亚洲视频在线观看网站| 国产伦精品一区二区三区在线观看| 亚洲天堂视频在线观看| 久久精品中文| 亚洲精品国产精品久久清纯直播 | 激情校园亚洲| 女同性一区二区三区人了人一| 日韩午夜三级在线| 性欧美激情精品| 亚洲国产精品va| 欧美午夜精品一区二区三区| 久久国产日韩欧美| 日韩视频不卡| 久久青草久久| 亚洲视频axxx| 尤物yw午夜国产精品视频明星| 欧美二区在线看| 午夜精品久久久久久99热| 欧美成人中文字幕| 先锋亚洲精品| 日韩一级不卡| 韩国av一区二区三区| 欧美日韩精品免费观看视一区二区 | 午夜激情综合网| 在线观看av不卡| 欧美高清在线| 久久久久久九九九九| 一区二区不卡在线视频 午夜欧美不卡在 | 香蕉乱码成人久久天堂爱免费| 欧美粗暴jizz性欧美20| 亚洲欧洲av一区二区| 亚洲精品久久久久久久久| 国产日韩欧美视频| 国产精品黄色在线观看| 欧美福利影院| 久久九九热免费视频| 亚洲一区二区在线播放| 91久久久精品| 欧美aaaaaaaa牛牛影院| 久久国产精品久久久久久久久久| 亚洲午夜精品视频| 亚洲精品一区二区三区蜜桃久| 极品日韩久久| 国产亚洲激情| 国产精品丝袜白浆摸在线| 欧美日韩精品欧美日韩精品| 欧美+日本+国产+在线a∨观看| 欧美一区二区黄| 亚洲一区二区三区在线播放| 亚洲国产精品成人一区二区| 久热精品在线| 久久久噜噜噜| 久久久久国产精品一区| 欧美一区二区三区在线视频| 亚洲综合色自拍一区| 亚洲丝袜av一区| 夜夜躁日日躁狠狠久久88av| 最近中文字幕日韩精品| 激情自拍一区| 永久域名在线精品| 在线成人免费观看| 亚洲电影免费观看高清完整版在线| 国内精品一区二区三区| 国产综合激情| 激情国产一区| 亚洲高清视频一区| 亚洲美女黄网| 中文av一区特黄| 亚洲香蕉成视频在线观看| 在线视频欧美日韩精品| 亚洲一区影院| 久久精品国产一区二区三| 久久久久国产一区二区| 久久精品夜色噜噜亚洲a∨ | 欧美搞黄网站| 99国内精品久久| 亚洲一区二区三区久久| 亚洲专区一区二区三区| 久久精品国产免费看久久精品|