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

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

潛心看書研究!

常用鏈接

留言簿(19)

隨筆分類(81)

文章分類(89)

相冊

ACM OJ

My friends

搜索

  •  

積分與排名

  • 積分 - 219409
  • 排名 - 118

最新評論

閱讀排行榜

評論排行榜

PKU 3093 Margaritas on the River Walk
        先對輸入的數(shù)組排序,然后類似于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(bǔ)[i]加進(jìn)以前的選擇里面
                                         else d[i][j]++;//a[i]單獨作為一個選擇(這里需要先對a[i]排序,消除后效性)
                               }
                        }
                 }
         }

PKU 1037 A decorative fence
        先dp算出以i為起點的序列的個數(shù),再組合數(shù)學(xué)
        td[n][i]和tu[n][i]分別表示個數(shù)為n,以i開始的上升和下降的序列個數(shù)
        易知:
        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
        雙調(diào)歐幾里德旅行商問題(明顯階段dp)
        動態(tài)規(guī)劃方程 :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
        狀態(tài)表示: d[i][j][k] (i為13為二進(jìn)制表示點的狀態(tài), j為當(dāng)前節(jié)點, k為到達(dá)j的前驅(qū)節(jié)點)

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

FeedBack:
# re: 對一些DP題目的小結(jié) 2007-04-22 08:56 byron
豪大牛,問一下,這是一些題目嗎????  回復(fù)  更多評論
  
# re: 對一些DP題目的小結(jié) 2007-04-24 00:52 
@byron
是pku上的題目,我菜菜啊。。。  回復(fù)  更多評論
  
# re: 對一些DP題目的小結(jié) 2007-04-26 18:59 oyjpart
呵呵 就聊上了啊 :)  回復(fù)  更多評論
  
# re: 對一些DP題目的小結(jié) 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
  回復(fù)  更多評論
  
# re: 對一些DP題目的小結(jié) 2007-06-30 22:59 姜雨生
應(yīng)該可以更加優(yōu)化  回復(fù)  更多評論
  
青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <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| 136国产福利精品导航网址应用| 久久久久国产精品厨房| 久久在线精品| 99re视频这里只有精品| 在线一区二区三区四区| 国产一本一道久久香蕉| 欧美成人精品福利| 欧美女主播在线| 欧美专区在线观看| 欧美aⅴ一区二区三区视频| 亚洲在线成人精品| 久久久www| 亚洲一区二区伦理| 久久国产精品毛片| 一区二区日本视频| 欧美一区二区三区的| 亚洲精品久久7777| 亚洲欧美日韩国产一区二区| 亚洲国产第一| 亚洲一区二区欧美日韩| 亚洲国产裸拍裸体视频在线观看乱了 | 国产精品视频九色porn| 欧美成人精品一区二区| 国产精品进线69影院| 欧美成人午夜| 国产精品一区二区三区乱码| 欧美成人中文字幕| 国产美女精品在线| 99视频精品在线| 亚洲国产精品一区二区第一页 | 免费久久久一本精品久久区| 亚洲欧美成人综合| 欧美激情中文字幕一区二区| 久久人人九九| 国产精品色网| 亚洲毛片av| 亚洲欧洲一二三| 久久精品国产第一区二区三区最新章节 | 亚洲国产欧美国产综合一区| 午夜精品久久久久久久99黑人| 一本久久综合亚洲鲁鲁| 久久综合色88| 久久亚洲私人国产精品va媚药| 国产精品久久二区| 日韩一区二区电影网| 日韩午夜av电影| 女人色偷偷aa久久天堂| 老司机精品视频网站| 国内精品亚洲| 久久成年人视频| 久久精品免费| 国产午夜精品久久| 欧美亚洲一区| 久久久精品一品道一区| 国产视频在线观看一区| 亚洲欧美资源在线| 久久精品99国产精品| 国产午夜精品全部视频播放 | 日韩视频在线观看一区二区| 日韩天堂在线视频| 欧美日韩国产成人在线91| 亚洲国产三级| 日韩视频精品在线观看| 欧美丰满少妇xxxbbb| 亚洲精品老司机| 亚洲一区二区影院| 国产乱肥老妇国产一区二| 亚洲一区在线观看视频| 欧美在线一区二区| 韩国精品一区二区三区| 久久综合一区二区三区| 亚洲第一成人在线| 在线视频欧美精品| 国产精品美女久久久| 欧美一区二区三区喷汁尤物| 麻豆精品在线视频| 亚洲精品看片| 国产精品美女在线| 久久精选视频| 亚洲精品黄网在线观看| 午夜亚洲一区| 亚洲国产成人精品久久| 欧美日韩一二三四五区| 欧美亚洲一区| 亚洲人成啪啪网站| 欧美在线免费视频| 亚洲国产日日夜夜| 国产精品日韩在线一区| 久久亚洲精选| 中文久久精品| 欧美国产欧美综合| 午夜视频一区| 亚洲人成网站影音先锋播放| 国产精品久久久久9999高清| 久久精品国产亚洲一区二区三区| 亚洲精品三级| 老色鬼精品视频在线观看播放| 日韩午夜精品视频| 国产一区欧美| 欧美三级视频在线| 久久夜色精品国产欧美乱| 在线午夜精品自拍| 欧美大片一区二区| 久久爱91午夜羞羞| 中文网丁香综合网| 1024精品一区二区三区| 国产精品亚洲综合一区在线观看| 久久综合伊人77777麻豆| 亚洲一区美女视频在线观看免费| 欧美激情亚洲激情| 久久免费黄色| 欧美一区二区视频在线观看| 日韩亚洲欧美高清| 樱桃成人精品视频在线播放| 国产精品一区二区视频| 欧美日韩高清在线一区| 久久综合网络一区二区| 欧美在线视频a| 亚洲午夜精品网| 日韩一区二区久久| 亚洲激情在线| 亚洲第一搞黄网站| 裸体女人亚洲精品一区| 久久av在线| 欧美亚洲一区二区三区| 亚洲综合色激情五月| 一区二区不卡在线视频 午夜欧美不卡'| 国内视频一区| 国产在线精品一区二区中文| 国产精品一区二区三区免费观看| 国产精品第十页| 国产精品99免视看9| 欧美日韩精品免费在线观看视频| 欧美成人tv| 欧美成人一区二区在线| 美女主播视频一区| 欧美成人69av| 欧美激情综合五月色丁香| 欧美国产极速在线| 欧美另类女人| 欧美视频导航| 国产精品永久免费视频| 国产日产亚洲精品| 国产午夜精品一区理论片飘花 | 欧美好骚综合网| 欧美理论视频| 国产精品久久二区| 国产一区二区看久久| 狠狠色丁香婷综合久久| 亚洲国产成人精品久久久国产成人一区| 精品成人一区二区三区四区| 亚洲国产精品电影在线观看| 亚洲人成在线播放| 亚洲一区二区三区高清不卡| 性色av一区二区三区| 久久精品国产精品| 欧美国产在线观看| 一本久久精品一区二区| 亚欧成人精品| 欧美大片在线影院| 国产精品久久国产精麻豆99网站| 国产精品永久免费| 亚洲国产欧美精品| 亚洲综合精品自拍| 久久伊人一区二区| 91久久久久久国产精品| 亚洲欧美一区二区视频| 久久天天躁狠狠躁夜夜av| 欧美日韩精品欧美日韩精品一| 国产精品视频yy9099| 91久久黄色| 欧美亚洲午夜视频在线观看| 免费日韩视频| 亚洲一区在线播放| 欧美高清视频免费观看| 国产美女精品一区二区三区| 亚洲黄色三级| 欧美在线视频a| 亚洲精品一二区| 欧美综合国产精品久久丁香| 欧美日韩精品久久久| 狠色狠色综合久久| 亚洲欧美日韩在线高清直播| 亚洲第一在线综合网站| 午夜精品剧场| 欧美日韩在线一二三| 亚洲国产欧美不卡在线观看 | 亚洲精品在线观看免费| 久久九九国产精品| av成人免费在线| 免费亚洲电影在线| 国内精品久久久久久久影视麻豆| 亚洲永久免费视频| 亚洲日本理论电影| 牛牛精品成人免费视频| 黄色亚洲大片免费在线观看| 性色av一区二区三区红粉影视|