• <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>

            公告

            聯系我:我的126郵箱: billhsu。 Locations of visitors to this page
            <2008年9月>
            31123456
            78910111213
            14151617181920
            21222324252627
            2829301234
            567891011

            統計

            • 隨筆 - 41
            • 文章 - 0
            • 評論 - 82
            • 引用 - 0

            常用鏈接

            留言簿(16)

            隨筆分類

            隨筆檔案

            相冊

            Game Dev

            搜索

            •  

            最新評論

            閱讀排行榜

            評論排行榜

            stredit problem
            s and t are two strings.
            Change string s into string t in the least steps.
            In each step you can insert or delete a char of the string.
            INPUT n1 s
            n2 t
            n1 is the length of string s
            n2 is the length of string t
            OUT the least steps
            exp:
            INPUT 4 abcd
            6 aefbhd
            OUT 4
            #include<iostream>
            #include
            <string>

            using namespace std;

            string s1,s2;
            int map[100];
            int i,j,result[100];
            int n1,n2,nc;

            int main(){
                cin
            >>n1>>s1>>n2>>s2;
                nc
            =0;
                
            for (i=0;i<n1;i++){
                    
            if ((j=s2.find(s1[i]))>=0){
                      map[nc]
            =j;
                      s2.replace(j,
            1," ");
                      nc
            ++;
                      }
                      }
                result[nc
            -1]=1;
                
            for (i=nc-2;i>=0;i--){
                    
            for (j=i+1;j<nc;j++if ((map[i]<map[j])&&(result[i]<result[j])) result[i]=result[j];
                    result[i]
            ++;
                    }
                j
            =0;
                
            for (i=0;i<nc;i++if(result[i]>j) j=result[i];
                cout
            <<n1+n2-j-j;
                system(
            "pause");
                
            return 0;
            }



            posted on 2008-08-01 13:41 Bill Hsu 閱讀(322) 評論(0)  編輯 收藏 引用 所屬分類: Algorithm

            俺来也俺去啦久久综合网| 国产福利电影一区二区三区久久久久成人精品综合 | 四虎久久影院| 久久婷婷色综合一区二区| 亚洲AV无码久久精品蜜桃| 国产一级持黄大片99久久| 久久久久九九精品影院| 97精品伊人久久大香线蕉| 久久综合亚洲欧美成人| 国产高潮国产高潮久久久91| 97香蕉久久夜色精品国产| 狠狠色丁香久久综合五月| 久久久中文字幕日本| 热re99久久精品国99热| 久久国产精品一区| 激情伊人五月天久久综合| 欧美伊人久久大香线蕉综合| 91久久成人免费| 精品熟女少妇av免费久久| 香蕉久久永久视频| 久久99精品国产| 性欧美丰满熟妇XXXX性久久久| 久久99中文字幕久久| 久久久久人妻精品一区| 超级97碰碰碰碰久久久久最新| 亚洲一区中文字幕久久| 久久久噜噜噜久久中文福利| 久久这里只精品99re66| 久久av高潮av无码av喷吹| 91精品国产高清久久久久久io| 久久SE精品一区二区| 久久久久久久91精品免费观看| 欧美精品福利视频一区二区三区久久久精品 | 久久精品午夜一区二区福利 | 91麻豆国产精品91久久久| 国产综合精品久久亚洲| 久久精品国产精品青草 | 久久久久国产一区二区| 亚洲午夜久久久精品影院| 国产精品免费久久| 久久久久亚洲AV无码去区首|