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

隨筆 - 87  文章 - 279  trackbacks - 0
<2007年8月>
2930311234
567891011
12131415161718
19202122232425
2627282930311
2345678

潛心看書研究!

常用鏈接

留言簿(19)

隨筆分類(81)

文章分類(89)

相冊

ACM OJ

My friends

搜索

  •  

積分與排名

  • 積分 - 220431
  • 排名 - 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 閱讀(2148) 評論(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>
              亚洲国产精品精华液2区45| 国产精品成人aaaaa网站| 噜噜噜91成人网| 另类专区欧美制服同性| 免费不卡欧美自拍视频| 免费看成人av| 99xxxx成人网| 久久大香伊蕉在人线观看热2| 香蕉尹人综合在线观看| 久久久久高清| 性欧美1819sex性高清| 久久综合影视| 亚洲视频网在线直播| 欧美在线免费播放| 欧美连裤袜在线视频| 国语精品一区| 亚洲欧美激情精品一区二区| 免费看的黄色欧美网站| 日韩午夜在线播放| 麻豆国产va免费精品高清在线| 欧美日韩在线高清| 亚洲日本视频| 欧美成人一区二区三区片免费| 日韩午夜激情av| 欧美aⅴ99久久黑人专区| 韩日精品中文字幕| 先锋影音网一区二区| 亚洲精品一级| 欧美日韩mp4| 亚洲欧美日韩一区二区三区在线| 久久久久国产精品厨房| 国产欧美一区二区在线观看| 亚洲线精品一区二区三区八戒| 久久综合色一综合色88| 久久狠狠亚洲综合| 韩日欧美一区二区三区| 久久九九国产| 久久精品盗摄| 亚洲高清在线| 亚洲精品1区| 欧美日韩中文| 久久久久久久波多野高潮日日| 欧美综合激情网| 亚洲精品国久久99热| 国产精品国产三级国产aⅴ入口| 亚洲无限av看| 久久久噜噜噜久久狠狠50岁| 亚洲三级免费观看| 亚洲欧美日韩在线高清直播| 黄色亚洲免费| 亚洲视频电影图片偷拍一区| 激情久久中文字幕| 亚洲日本电影在线| 欧美精品黄色| 久久九九电影| 国产精品v一区二区三区| 久久国产精品亚洲va麻豆| 美女亚洲精品| 久久久免费观看视频| 欧美人与禽性xxxxx杂性| 久久不射中文字幕| 性xx色xx综合久久久xx| 猛男gaygay欧美视频| 久久精品一区二区三区四区 | 欧美四级电影网站| 免费一级欧美片在线观看| 国产欧美亚洲一区| 亚洲性图久久| 性欧美大战久久久久久久免费观看| 欧美+日本+国产+在线a∨观看| 久久久欧美精品| 国产一区久久| 裸体歌舞表演一区二区| 你懂的网址国产 欧美| 亚洲福利一区| 国产精品视频xxxx| 国产美女精品免费电影| 亚洲综合色噜噜狠狠| 欧美精品一区二区三区久久久竹菊 | 久久高清国产| 国产喷白浆一区二区三区| 一本一本久久| 亚洲综合色丁香婷婷六月图片| 欧美激情视频一区二区三区在线播放 | 久久免费一区| 欧美激情va永久在线播放| 亚洲美女av电影| 国产精品私人影院| 午夜亚洲精品| 亚洲色图制服丝袜| 亚洲观看高清完整版在线观看| 亚洲毛片一区二区| 影音国产精品| 国产日韩欧美在线视频观看| 亚洲自拍啪啪| 亚洲国产精品ⅴa在线观看| 国产亚洲精品久| 欧美日韩三级一区二区| 嫩草成人www欧美| 老牛影视一区二区三区| 午夜精品福利视频| 亚洲男人第一网站| 亚洲欧美日韩一区二区| 性色一区二区三区| 午夜精彩视频在线观看不卡 | 亚洲美女在线观看| 亚洲视频中文字幕| 六月婷婷一区| 国产精品海角社区在线观看| 国产精品免费小视频| 国产日韩一区二区| 亚洲欧洲日韩女同| 亚洲一卡久久| 免费观看在线综合色| 亚洲风情在线资源站| 一本色道久久99精品综合 | 亚洲图片激情小说| 欧美资源在线| 欧美日韩国产综合网| 黄色成人免费观看| 亚洲无限乱码一二三四麻| 久久在线免费视频| 亚洲国产精品尤物yw在线观看| 久久精品一区二区三区四区| 免费亚洲网站| 欧美一区二区三区播放老司机| 欧美1区3d| 在线成人黄色| 性欧美大战久久久久久久免费观看 | 亚洲综合电影一区二区三区| 欧美伊人久久| 99精品福利视频| 久久先锋影音| 好吊色欧美一区二区三区视频| 亚洲精品免费在线| 久久综合给合久久狠狠色| 亚洲与欧洲av电影| 欧美日韩在线影院| 亚洲午夜精品国产| 亚洲午夜精品久久久久久app| 国产精品一区免费在线观看| 免费一区视频| 欧美午夜精品| 久久激情一区| 欧美华人在线视频| 亚洲永久在线观看| 另类亚洲自拍| 久久综合久久久| 亚洲人成在线观看一区二区| 毛片一区二区| 久久亚洲一区二区| 99精品99久久久久久宅男| 日韩亚洲欧美中文三级| 国产精品黄色在线观看| 久久激情婷婷| 欧美**人妖| 亚洲一区三区电影在线观看| 亚洲女性裸体视频| 亚洲黑丝在线| 一区二区欧美亚洲| 有码中文亚洲精品| 亚洲精品欧美| 在线电影国产精品| 亚洲最快最全在线视频| 激情久久综艺| 一区二区三区高清在线观看| 伊人久久亚洲热| 99亚洲一区二区| 亚洲青涩在线| 欧美在线一级视频| 亚洲女人天堂av| 欧美国产一区在线| 欧美午夜片在线观看| 久久精品最新地址| 欧美日韩成人激情| 亚洲国产精品一区二区第一页| 国产区精品视频| 99re热精品| 日韩一级黄色大片| 久色婷婷小香蕉久久| 久久裸体艺术| 国产亚洲网站| 亚欧美中日韩视频| 欧美主播一区二区三区美女 久久精品人| 欧美jjzz| 99v久久综合狠狠综合久久| 亚洲美女精品成人在线视频| 开心色5月久久精品| 亚洲国产精品日韩| 夜夜嗨av一区二区三区免费区| 欧美高清在线观看| 亚洲精品一区二| 亚洲一区二区三区涩| 国产精品乱码久久久久久| 亚洲一区二区精品在线观看| 欧美专区福利在线| 亚洲成色www久久网站| 欧美精品二区三区四区免费看视频| 亚洲第一黄网| 欧美在线观看www|