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

隨筆 - 87  文章 - 279  trackbacks - 0
<2007年4月>
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345

潛心看書研究!

常用鏈接

留言簿(19)

隨筆分類(81)

文章分類(89)

相冊

ACM OJ

My friends

搜索

  •  

積分與排名

  • 積分 - 221003
  • 排名 - 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 閱讀(2154) 評論(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>
              国产综合欧美在线看| 国产一区二区毛片| 亚洲视频电影图片偷拍一区| 亚洲黄色av| 欧美日韩一区在线观看| 亚洲一级网站| 先锋影音国产精品| 激情综合网址| 亚洲人体影院| 欧美系列精品| 久久国产一二区| 蜜桃精品久久久久久久免费影院| 亚洲国产日韩欧美在线动漫| 亚洲欧洲日本国产| 国产精品日日摸夜夜摸av| 欧美一区二区视频网站| 久久久久久久久岛国免费| 亚洲黄色影院| 亚洲永久免费| 亚洲丁香婷深爱综合| 日韩视频欧美视频| 国产欧美一区二区三区在线老狼| 美女视频黄 久久| 欧美区在线观看| 久久精品国产一区二区三| 你懂的视频欧美| 欧美在线播放| 欧美精品成人| 麻豆精品国产91久久久久久| 欧美老女人xx| 麻豆精品精华液| 欧美性大战久久久久久久| 久久综合电影| 国产精品系列在线播放| 亚洲大胆在线| 韩日视频一区| 亚洲视频一二区| 亚洲人成网站色ww在线| 欧美一区免费视频| 亚洲一二三区在线观看| 久久亚洲精品一区| 午夜精品美女久久久久av福利| 久久综合久久久久88| 亚洲欧美国产高清| 欧美日本国产视频| 欧美xx69| 红杏aⅴ成人免费视频| 亚洲一区二区三区四区在线观看| 亚洲精品乱码久久久久久日本蜜臀| 欧美亚洲日本网站| 亚洲综合久久久久| 欧美日韩国产精品专区| 亚洲国产va精品久久久不卡综合| 国产一区av在线| 亚洲欧美激情一区| 亚洲欧美日韩精品久久久久| 欧美日韩日本网| 亚洲欧洲一级| 一本色道久久88亚洲综合88| 美国成人直播| 欧美成人国产| 亚洲二区视频在线| 久久一区中文字幕| 免费视频亚洲| 亚洲国产日韩欧美| 麻豆国产va免费精品高清在线| 久久综合免费视频影院| 国产一区二区三区四区三区四| 午夜日韩在线观看| 久久久噜噜噜久噜久久| 国内精品久久久久影院 日本资源| 午夜国产精品视频免费体验区| 亚洲欧美一区二区三区在线| 国产精品福利久久久| 亚洲一区二区网站| 欧美有码视频| 激情五月婷婷综合| 另类亚洲自拍| 亚洲全部视频| 亚洲一区亚洲二区| 国产欧美一区二区三区在线老狼 | 久久久蜜桃一区二区人| 久久久蜜臀国产一区二区| 国内精品嫩模av私拍在线观看| 久久九九久久九九| 欧美jizz19性欧美| 夜夜嗨网站十八久久| 国产精品另类一区| 久久精品国产久精国产一老狼| 嫩草国产精品入口| 一区二区三区精密机械公司| 国产精品久久77777| 久久国产66| 亚洲每日更新| 久久久久久久性| 亚洲美女色禁图| 国产精品日韩精品| 久久亚洲色图| 在线中文字幕不卡| 久热爱精品视频线路一| 国产精品99久久久久久久久久久久| 国产精品毛片a∨一区二区三区|国| 久久精品最新地址| 日韩亚洲在线| 欧美jizzhd精品欧美巨大免费| 亚洲天堂激情| 亚洲国产另类久久久精品极度| 欧美午夜精品久久久| 久久精品人人| 亚洲一区久久久| 亚洲国产cao| 久久亚洲综合色一区二区三区| 一区二区三区精品久久久| 国内久久精品视频| 国产精品劲爆视频| 欧美成人精品1314www| 欧美一级大片在线观看| 亚洲精品资源美女情侣酒店| 麻豆精品一区二区av白丝在线| 亚洲综合二区| 一区二区高清在线| **欧美日韩vr在线| 国产一区香蕉久久| 国产精品日韩一区二区三区| 欧美日韩激情小视频| 老司机精品视频网站| 欧美一级片一区| 亚洲伊人伊色伊影伊综合网| 农夫在线精品视频免费观看| 久久国产色av| 小嫩嫩精品导航| 一本色道久久| 99在线|亚洲一区二区| 亚洲激情一区| 亚洲人成艺术| 亚洲欧洲一区| 亚洲人www| 亚洲日韩欧美视频一区| 亚洲激情中文1区| 亚洲国产精品成人一区二区 | 国产精品久久久久久久久久久久| 欧美高清影院| 欧美成人一区二区三区在线观看 | 国产伦精品一区二区三区视频孕妇| 欧美区在线播放| 欧美日韩国产一区精品一区| 欧美日韩mv| 欧美日韩在线一二三| 欧美特黄一区| 国产精品免费在线| 国产欧美日韩一区二区三区在线 | 老司机午夜精品| 久久久噜噜噜久噜久久| 开心色5月久久精品| 免费久久精品视频| 裸体一区二区三区| 欧美久久精品午夜青青大伊人| 欧美精品日韩三级| 欧美日韩一卡| 国产欧美日韩在线视频| 国产亚洲欧美另类中文 | 欧美日韩在线观看一区二区三区| 欧美精品久久久久久| 欧美特黄a级高清免费大片a级| 国产精品视频yy9299一区| 国产亚洲午夜| 亚洲肉体裸体xxxx137| 亚洲视频在线视频| 久久激情综合网| 欧美电影免费观看高清| 亚洲看片免费| 欧美影院午夜播放| 免费观看成人| 国产精品久久久久免费a∨ | 欧美日韩第一区日日骚| 国产精品免费看| 亚洲福利视频在线| 亚洲无人区一区| 蜜桃av一区二区三区| 999在线观看精品免费不卡网站| 午夜在线一区二区| 欧美黄色日本| 国产麻豆精品在线观看| 91久久精品日日躁夜夜躁欧美 | 亚洲一区在线观看视频| 久久久久久9| 夜夜嗨av一区二区三区免费区| 久久www免费人成看片高清| 欧美日韩国产限制| 狠狠色综合色区| 午夜欧美精品久久久久久久| 欧美黄色精品| 久久av一区二区三区漫画| 欧美日韩精品国产| 在线日韩精品视频| 久久国产精品99精品国产| 亚洲精品中文字幕有码专区| 久久视频精品在线| 国产视频不卡| 亚洲欧美一区二区三区久久|