• <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
            <2009年6月>
            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 閱讀(316) 評論(0)  編輯 收藏 引用 所屬分類: Algorithm

            久久久久久国产精品免费免费| 精品国产一区二区三区久久久狼 | 婷婷久久综合九色综合九七| 久久久久国产精品麻豆AR影院 | 青青草国产成人久久91网| 日本一区精品久久久久影院| 女同久久| 久久不射电影网| 久久午夜无码鲁丝片秋霞 | 香蕉久久夜色精品升级完成| 久久99热国产这有精品| 亚洲欧美成人久久综合中文网| 亚洲色大成网站www久久九| 久久综合综合久久狠狠狠97色88| 午夜精品久久久内射近拍高清| jizzjizz国产精品久久| 日韩欧美亚洲国产精品字幕久久久| 奇米影视7777久久精品| 久久久91人妻无码精品蜜桃HD| 久久婷婷五月综合色高清 | 国产69精品久久久久APP下载| 久久久久一区二区三区| 久久免费看黄a级毛片| 久久精品成人影院| 国产A级毛片久久久精品毛片| 国产人久久人人人人爽| 一本久久a久久精品vr综合| 久久九色综合九色99伊人| 久久精品视频网| 久久97精品久久久久久久不卡| 精品久久久无码人妻中文字幕| 99精品国产免费久久久久久下载| 国产精品99久久久久久董美香| 久久精品国产亚洲欧美| www.久久99| 一本大道加勒比久久综合| 久久精品国产只有精品2020| 精品久久777| 国产免费福利体检区久久| 国产99久久九九精品无码| 久久国产高清一区二区三区|