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

            公告

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

            統(tǒng)計

            • 隨筆 - 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 閱讀(329) 評論(0)  編輯 收藏 引用 所屬分類: Algorithm

            欧美精品九九99久久在观看| 久久婷婷综合中文字幕| 亚洲国产成人精品女人久久久| 四虎久久影院| 久久人人爽人人爽人人AV东京热| 久久99久久99小草精品免视看| 欧洲性大片xxxxx久久久| 日韩精品久久久久久免费| 久久天天躁狠狠躁夜夜不卡| 色婷婷综合久久久久中文| 超级碰久久免费公开视频| 久久久久人妻精品一区| 久久精品国产亚洲5555| 99久久婷婷免费国产综合精品| 亚洲精品99久久久久中文字幕| 国产成人久久久精品二区三区 | 伊人色综合九久久天天蜜桃| 精品久久久久久成人AV| 国产精品久久久久免费a∨| 狠狠久久综合| 99久久国产综合精品五月天喷水| 久久亚洲中文字幕精品有坂深雪 | 久久99国产综合精品女同| 久久伊人五月天论坛| www亚洲欲色成人久久精品| 久久国产高潮流白浆免费观看| 一本色道久久综合亚洲精品| 久久精品人妻中文系列| 伊人久久大香线蕉综合网站| 亚洲AⅤ优女AV综合久久久| 伊人精品久久久久7777| 亚洲?V乱码久久精品蜜桃| 久久中文字幕无码专区| 老司机午夜网站国内精品久久久久久久久| 久久精品国产一区二区三区日韩| 97久久久久人妻精品专区 | 精品无码久久久久国产动漫3d| 怡红院日本一道日本久久| 成人亚洲欧美久久久久| 久久久久97国产精华液好用吗| 久久午夜福利电影|