• <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
            <2025年8月>
            272829303112
            3456789
            10111213141516
            17181920212223
            24252627282930
            31123456

            統計

            • 隨筆 - 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热| 久久婷婷五月综合色奶水99啪| 亚洲精品美女久久777777| 久久精品aⅴ无码中文字字幕不卡 久久精品aⅴ无码中文字字幕重口 | 99久久久久| 日本WV一本一道久久香蕉| 69国产成人综合久久精品| 日本加勒比久久精品| 久久99国产综合精品女同| 久久亚洲2019中文字幕| 精品久久久久久中文字幕人妻最新| 国产精品综合久久第一页| 久久99精品久久久久久hb无码| 色婷婷久久久SWAG精品| 久久九九全国免费| 亚洲香蕉网久久综合影视| 久久免费大片| 国产日韩久久免费影院| 99久久精品国产高清一区二区| 老男人久久青草av高清| 一本大道久久东京热无码AV| 99久久国产综合精品成人影院| 久久天天躁狠狠躁夜夜avapp| 亚洲精品国精品久久99热| 午夜视频久久久久一区 | 一本久久精品一区二区| 久久中文精品无码中文字幕| 国产99久久久久久免费看| 久久九九青青国产精品| 亚洲欧美日韩精品久久| 欧美久久精品一级c片片| 久久久久久狠狠丁香| 久久亚洲高清观看| 久久黄色视频| 亚洲午夜久久久| 精品国产乱码久久久久久人妻| 久久精品aⅴ无码中文字字幕不卡| 一本一道久久a久久精品综合 | 国产成人精品久久一区二区三区av | 午夜精品久久久久久久无码|