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

隨筆 - 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>
              欧美一区2区三区4区公司二百| 欧美大片免费久久精品三p | 欧美一级夜夜爽| 一区二区三区鲁丝不卡| 欧美午夜欧美| 欧美在线日韩在线| 久久偷窥视频| 亚洲久久一区| 中文成人激情娱乐网| 国产精品一区一区三区| 久久久噜噜噜久久狠狠50岁| 久久久之久亚州精品露出| 亚洲国产美女精品久久久久∴| 亚洲成色777777女色窝| 欧美日本三区| 欧美一级专区免费大片| 久久国产精品黑丝| 亚洲片区在线| 一区二区三区日韩精品| 黑人极品videos精品欧美裸| 亚洲成人资源| 国产农村妇女精品一区二区| 免费亚洲一区| 国产精品久久久久久一区二区三区| 欧美一区二区三区免费看| 久久久久国产免费免费| 亚洲午夜在线| 久久精品人人做人人爽电影蜜月| 亚洲精品国产视频| 香港久久久电影| 一区二区三区高清在线观看| 欧美怡红院视频| 亚洲午夜av| 久久综合九色综合网站| 午夜免费日韩视频| 欧美激情 亚洲a∨综合| 久久久久国产精品厨房| 欧美精品综合| 你懂的视频一区二区| 国产精品丝袜久久久久久app| 你懂的网址国产 欧美| 国产精品私房写真福利视频| 亚洲精品中文字幕在线| 激情久久久久久久| 亚洲国产日韩欧美在线图片| 99精品久久久| 日韩香蕉视频| 玖玖国产精品视频| 欧美一区三区二区在线观看| 欧美日韩国产专区| 欧美激情中文字幕在线| 在线精品国产欧美| 久久国内精品自在自线400部| 亚洲欧美精品在线| 欧美午夜片欧美片在线观看| 亚洲国产精品免费| 在线观看成人av| 欧美一区日韩一区| 久久精品国产欧美亚洲人人爽| 欧美日韩直播| 一区二区电影免费在线观看| 99国内精品| 欧美日韩高清区| 亚洲人成高清| 在线亚洲免费| 欧美视频在线观看免费网址| 日韩一级黄色片| 亚洲一区二区视频| 国产精品久久毛片a| 亚洲一本大道在线| 欧美在线视频免费观看| 国产精品亚洲一区二区三区在线| 亚洲一区二区三区免费在线观看| 亚洲视频在线一区| 国产精品黄视频| 在线亚洲一区| 久久精品道一区二区三区| 国产偷久久久精品专区| 欧美一区二区日韩一区二区| 久久看片网站| 亚洲欧洲综合| 欧美视频精品在线| 午夜精品久久久久久| 久久久www成人免费精品| 亚洲大胆视频| 欧美精品一区二区三区在线播放| 亚洲日本成人| 久久国产精品毛片| 在线欧美不卡| 欧美日韩在线播放三区四区| 亚洲欧美日韩另类| 久久在线精品| 一区二区三区欧美| 国产精品综合| 欧美.com| 亚洲私人黄色宅男| 男人的天堂亚洲在线| 夜夜躁日日躁狠狠久久88av| 国产情人节一区| 欧美超级免费视 在线| 亚洲手机成人高清视频| 免费观看成人www动漫视频| 夜夜嗨一区二区三区| 国产一区二区精品久久91| 欧美成人免费全部观看天天性色| 一区二区三区精密机械公司| 欧美va亚洲va国产综合| 亚洲欧美日韩国产| 亚洲国产高清aⅴ视频| 国产精品v欧美精品v日韩| 久久综合久久综合久久| 亚洲一区二区三区在线看| 亚洲高清视频在线| 久久国产精品99国产| 国产精品99久久久久久久久久久久| 国产丝袜一区二区三区| 欧美日韩亚洲一区二区三区在线观看 | 欧美一区二区黄色| 日韩视频永久免费观看| 久久久久一区二区三区| 亚洲图片欧美一区| 最新中文字幕亚洲| 好看的日韩av电影| 国产女主播视频一区二区| 欧美精品一区二区三区在线看午夜 | 亚洲视频在线观看三级| 亚洲国产cao| 快射av在线播放一区| 欧美一区二区三区在线看| 中文一区二区在线观看| 亚洲精品综合精品自拍| 亚洲第一精品电影| 黄色一区二区三区| 国产亚洲aⅴaaaaaa毛片| 国产精品系列在线播放| 欧美视频一区二区三区四区| 欧美连裤袜在线视频| 久久久欧美精品| 久久爱www久久做| 欧美在线视频免费| 欧美主播一区二区三区| 性欧美18~19sex高清播放| 亚洲一区二区三区乱码aⅴ蜜桃女 亚洲一区二区三区乱码aⅴ | 国内成人精品一区| 国产三级欧美三级| 国产精品一区久久久| 国产精品一区二区在线观看| 国产精品午夜在线| 国产精品视频导航| 国产九九精品视频| 国产酒店精品激情| 国产一区二区三区无遮挡| 国产欧美二区| 国外成人在线| 在线日韩中文| 999亚洲国产精| 亚洲一二区在线| 午夜精品国产更新| 久久国产黑丝| 欧美不卡一区| 亚洲美女精品成人在线视频| 一区二区欧美激情| 亚洲欧美在线一区二区| 久久精品91久久久久久再现| 久久免费的精品国产v∧| 欧美成人午夜77777| 欧美经典一区二区| 国产精品久久午夜夜伦鲁鲁| 国产一区在线播放| 亚洲国产欧美在线| 亚洲五月婷婷| 久久综合九色综合网站| 亚洲第一搞黄网站| 亚洲色诱最新| 久久免费视频网站| 欧美色大人视频| 国产一区二区三区观看| 亚洲国产裸拍裸体视频在线观看乱了中文 | 欧美激情一区二区三区高清视频| 欧美午夜不卡在线观看免费| 国产又爽又黄的激情精品视频| 亚洲国产日韩精品| 性刺激综合网| 欧美粗暴jizz性欧美20| 一区二区三区三区在线| 久久久久**毛片大全| 欧美日韩亚洲激情| 激情小说亚洲一区| 亚洲欧美日韩直播| 亚洲国产精品123| 亚洲欧美另类在线| 欧美护士18xxxxhd| 红桃视频欧美| 午夜精品久久久久久99热| 亚洲大胆美女视频| 久久av一区二区三区漫画| 欧美日韩国产综合视频在线| 亚洲第一毛片| 久久久久国产一区二区| av成人激情|