• <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无码| 亚洲中文久久精品无码ww16| 久久天天躁夜夜躁狠狠| 亚洲国产另类久久久精品黑人 | 国产精品久久久99| 亚洲国产精品久久久久网站| 99久久国产亚洲高清观看2024| 久久夜色精品国产亚洲| 久久91综合国产91久久精品| 亚洲国产精品婷婷久久| 国产成人久久777777| 狠狠人妻久久久久久综合蜜桃 | 99久久国产热无码精品免费| 精品999久久久久久中文字幕| 狠色狠色狠狠色综合久久| 国内精品久久久久影院网站| 亚洲欧洲久久久精品| 亚洲综合日韩久久成人AV| 欧美精品一本久久男人的天堂| 久久久国产精品| 乱亲女H秽乱长久久久| 久久亚洲美女精品国产精品| 97久久精品午夜一区二区| 免费精品久久天干天干| 国产精品一区二区久久不卡| 久久久久一区二区三区| 亚洲欧美国产日韩综合久久 | 久久久老熟女一区二区三区| 精品精品国产自在久久高清| 欧美粉嫩小泬久久久久久久 | 人人狠狠综合久久亚洲88| 免费一级做a爰片久久毛片潮| 久久人人爽爽爽人久久久| 久久精品国产精品亚洲下载| 日本强好片久久久久久AAA| 久久精品亚洲欧美日韩久久|