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

隨筆 - 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>
              亚洲精品一线二线三线无人区| 久久国产精品久久久| 免费欧美网站| 裸体女人亚洲精品一区| 亚洲国产成人久久综合| 亚洲国产日韩一区二区| 欧美激情免费观看| 亚洲一区在线播放| 午夜精品成人在线| 在线成人激情黄色| 亚洲精品国产精品乱码不99| 国产精品精品视频| 久久久亚洲国产天美传媒修理工 | 欧美成人中文字幕| 欧美日韩成人精品| 久久www免费人成看片高清| 久久久中精品2020中文| 99国产欧美久久久精品| 午夜在线观看欧美| 亚洲精品激情| 亚洲欧美日韩直播| 亚洲精品小视频| 亚洲综合精品自拍| 亚洲欧洲日本专区| 亚洲男人的天堂在线aⅴ视频| 一区二区三区在线视频观看| 亚洲美女少妇无套啪啪呻吟| 国内精品视频一区| 日韩一区二区精品| 亚洲国产成人在线| 香蕉成人久久| 一本色道**综合亚洲精品蜜桃冫| 欧美一区二区私人影院日本| 夜夜嗨一区二区| 久久久久九九九| 欧美亚洲日本国产| 欧美激情在线狂野欧美精品| 久久精品夜色噜噜亚洲a∨ | 午夜免费日韩视频| 99在线观看免费视频精品观看| 久久国产精彩视频| 亚洲欧美一区二区在线观看| 欧美国产一区二区在线观看| 久久嫩草精品久久久久| 国产精品久久久久久久久久三级| 亚洲国产欧美日韩精品| 精品不卡视频| 欧美一区二区大片| 欧美一级二级三级蜜桃| 欧美日韩在线视频首页| 亚洲级视频在线观看免费1级| 国产在线视频不卡二| 亚洲午夜在线| 亚洲欧美日韩中文视频| 欧美午夜精品久久久久久超碰| 亚洲丰满在线| 亚洲国产免费看| 久久久噜噜噜久噜久久| 久久久噜噜噜久噜久久| 国产一区二区三区电影在线观看| 亚洲网站在线| 午夜精品区一区二区三| 美女图片一区二区| 激情视频一区二区| 久热精品视频在线观看| 蘑菇福利视频一区播放| 亚洲国产成人在线| 免费日韩成人| 亚洲欧洲另类国产综合| 一本色道久久综合亚洲精品不| 欧美经典一区二区三区| 亚洲人精品午夜在线观看| 日韩亚洲成人av在线| 欧美日韩三级在线| 亚洲一区二区毛片| 久久国产99| 136国产福利精品导航网址| 欧美1级日本1级| 亚洲精选大片| 欧美一区二区国产| 国产一区二区三区免费在线观看| 欧美一区亚洲一区| 欧美国产日韩亚洲一区| 99精品视频免费观看| 国产精品成人国产乱一区| 午夜亚洲影视| 欧美激情精品久久久久久大尺度| 一本色道久久99精品综合| 国产精品久久国产精麻豆99网站| 性色av香蕉一区二区| 欧美成人精品一区二区| 99re亚洲国产精品| 国产欧美日韩精品一区| 久久综合色天天久久综合图片| 亚洲国产清纯| 欧美一区二区三区在线免费观看 | 国产一区二区三区免费观看| 欧美成人精品在线观看| 亚洲午夜国产一区99re久久| 久久一区中文字幕| 亚洲一区999| 悠悠资源网亚洲青| 国产精品啊啊啊| 蜜乳av另类精品一区二区| 亚洲一区二区三区乱码aⅴ蜜桃女 亚洲一区二区三区乱码aⅴ | 鲁大师成人一区二区三区| 一区二区三区高清在线| 久久字幕精品一区| 亚洲欧美久久久| **性色生活片久久毛片| 国产精品剧情在线亚洲| 麻豆精品视频在线观看| 亚洲欧美网站| 日韩视频不卡| 亚洲电影免费观看高清完整版| 香蕉免费一区二区三区在线观看 | 国产在线成人| 国产伦精品一区二区三区照片91| 欧美黄色成人网| 久久九九免费视频| 亚洲免费中文| 一区二区三区高清在线观看| 亚洲激情在线观看| 欧美成人精品影院| 久久影视精品| 久久久www成人免费毛片麻豆| 亚洲制服av| 亚洲视频免费观看| 99视频在线观看一区三区| 中文日韩欧美| 亚洲九九九在线观看| 亚洲激情网址| 亚洲高清网站| 亚洲国产精品高清久久久| 欧美成人综合网站| 美乳少妇欧美精品| 免费在线一区二区| 欧美成人一区二免费视频软件| 久久视频这里只有精品| 久久亚洲精品一区| 老司机午夜精品视频| 久久一综合视频| 欧美成人自拍视频| 亚洲国产小视频在线观看| 亚洲电影免费| 夜夜嗨av一区二区三区网站四季av| 亚洲国产精品国自产拍av秋霞| 亚洲国产高清一区| 亚洲人成人一区二区三区| 亚洲日本视频| 亚洲无限乱码一二三四麻| 亚洲特级片在线| 亚洲欧美在线免费| 久久久久www| 欧美/亚洲一区| 欧美日韩综合一区| 国产精品视频| 黄色成人在线免费| 91久久精品美女| 亚洲在线观看视频| 久久久一二三| 亚洲第一在线| 在线一区观看| 久久国产福利| 欧美精品videossex性护士| 欧美日韩一区二区国产| 国产亚洲观看| 亚洲人久久久| 欧美一级视频| 欧美成人国产| 亚洲午夜未删减在线观看| 久久久久久久一区二区| 欧美了一区在线观看| 国产视频在线观看一区二区| 亚洲激情校园春色| 亚洲欧美日韩国产综合在线| 美女被久久久| 一区二区久久久久| 久久天天躁狠狠躁夜夜爽蜜月| 欧美日韩国内| 在线成人免费视频| 亚洲在线观看免费视频| 欧美激情一区二区三区| 午夜日韩激情| 欧美激情综合五月色丁香| 国产主播喷水一区二区| 亚洲五月六月| 亚洲大胆人体在线| 性欧美长视频| 国产精品久久夜| 亚洲精品视频二区| 久久久综合香蕉尹人综合网| 日韩视频国产视频| 久久香蕉精品| 国产在线精品二区| 亚洲欧美精品伊人久久| 亚洲欧洲日夜超级视频| 老司机精品视频网站| 国产日韩精品一区二区三区在线| 亚洲视频福利|