• <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)計(jì)

            • 隨筆 - 41
            • 文章 - 0
            • 評(píng)論 - 82
            • 引用 - 0

            常用鏈接

            留言簿(16)

            隨筆分類(lèi)

            隨筆檔案

            相冊(cè)

            Game Dev

            搜索

            •  

            最新評(píng)論

            閱讀排行榜

            評(píng)論排行榜

            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 閱讀(317) 評(píng)論(0)  編輯 收藏 引用 所屬分類(lèi): Algorithm

            色综合久久中文字幕无码| 亚洲精品97久久中文字幕无码| 国产精品日韩深夜福利久久| 精品综合久久久久久888蜜芽| 伊人久久大香线蕉av不卡| 亚洲精品美女久久久久99小说| 久久久国产精品| 午夜精品久久久内射近拍高清| 一本久久免费视频| 亚洲天堂久久久| 亚洲综合熟女久久久30p| 久久久久人妻一区精品色 | 久久夜色精品国产亚洲| 久久中文精品无码中文字幕| 午夜精品久久久久久影视777| 国产精品久久久久久久人人看 | 99久久国产综合精品麻豆| 久久精品www人人爽人人| 久久婷婷国产麻豆91天堂| 国产精自产拍久久久久久蜜| 亚州日韩精品专区久久久| 亚洲乱码精品久久久久.. | 狠狠综合久久综合中文88| 日本精品久久久久影院日本 | 亚洲精品国产综合久久一线| 人妻无码中文久久久久专区| 国产69精品久久久久9999| 香蕉99久久国产综合精品宅男自| 日产精品久久久久久久| 爱做久久久久久| 久久青青草原精品国产| 天天综合久久久网| 99久久精品免费看国产一区二区三区 | 久久一区二区三区99| 无码精品久久久久久人妻中字| 丁香五月综合久久激情| 亚洲精品国产美女久久久| 久久99热这里只有精品国产 | 久久香蕉综合色一综合色88| 国产香蕉久久精品综合网| 91久久精品视频|