• <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>
            posts - 33,  comments - 25,  trackbacks - 0
            DFS+剪枝.剪枝主要是判斷現有輸出是否與最終期望字符串前綴匹配.
            Code
            posted on 2009-03-24 20:45 肖羽思 閱讀(1913) 評論(2)  編輯 收藏 引用 所屬分類: ZOJ

            FeedBack:
            # re: ZOJ 1004 解題報告
            2009-05-08 20:55 | D
            D  回復  更多評論
              
            # re: ZOJ 1004 解題報告
            2009-09-24 18:04 | bloodmoon
            @D
            為什么寫了這么長
            #include <stdio.h>
            #include <string.h>
            char s1[100],s2[100],stk[100],ans[200];
            int l1,l2;

            void output(int n)
            {
            int i;
            for(i=0;i+1<n;i++)
            {
            printf("%c ",ans[i]);
            }
            printf("%c\n",ans[i]);
            }

            void go(int in,int out,int p,int top)
            {
            if(top<0)return;
            if(in==l1 && out==l2)
            {
            output(p);
            return;
            }

            if(in<l1)
            {
            stk[top]=s1[in];
            ans[p]='i';
            go(in+1,out,p+1,top+1);
            }

            if(top>0 && out<l2 && stk[top-1]==s2[out])
            {
            ans[p]='o';
            go(in,out+1,p+1,top-1);
            stk[top-1]=s2[out];
            }
            }

            int main()
            {
            FILE * fp;
            fp = fopen("1004.in","r");
            while(fscanf(fp,"%s%s",s1,s2)==2)
            {
            l1=strlen(s1);
            l2=strlen(s2);
            printf("[\n");
            if(l1==l2)go(0,0,0,0);
            printf("]\n");
            }
            return 0;
            }  回復  更多評論
              
            <2011年4月>
            272829303112
            3456789
            10111213141516
            17181920212223
            24252627282930
            1234567

            常用鏈接

            留言簿(3)

            隨筆分類

            隨筆檔案

            文章分類

            文章檔案

            搜索

            •  

            最新評論

            閱讀排行榜

            評論排行榜

            国产精品久久久久影院色| 人妻无码久久一区二区三区免费 | 97久久国产露脸精品国产| 亚洲综合伊人久久综合| 久久夜色精品国产噜噜麻豆 | 久久久久亚洲精品男人的天堂| 99久久婷婷国产一区二区 | 久久综合综合久久综合| 99久久精品九九亚洲精品| 久久天天躁狠狠躁夜夜不卡 | 狠狠综合久久综合88亚洲| 2021国产成人精品久久| 久久WWW免费人成一看片| 免费观看久久精彩视频| 国产精品99久久久精品无码| 久久精品男人影院| 亚洲人成伊人成综合网久久久| 久久久91精品国产一区二区三区| 思思久久精品在热线热| 亚洲伊人久久大香线蕉苏妲己| 色综合久久久久无码专区| 久久久久久一区国产精品| 国产精品99久久精品| 亚洲精品乱码久久久久久蜜桃不卡| 亚洲国产精久久久久久久| 久久久久亚洲AV无码永不| 久久久久青草线蕉综合超碰| 精品久久人人做人人爽综合| 人人狠狠综合久久亚洲婷婷| 99精品国产在热久久无毒不卡 | 久久中文字幕一区二区| 久久精品国产精品亚洲毛片| 99精品国产综合久久久久五月天 | 很黄很污的网站久久mimi色| 久久久精品国产sm调教网站| 一本色道久久88精品综合| 亚洲精品乱码久久久久久自慰| 久久人人爽人人爽人人片av麻烦| 久久亚洲2019中文字幕| 久久综合伊人77777| 精品久久久久久国产91|