• <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>

            學習心得(code)

            superlong@CoreCoder

              C++博客 :: 首頁 :: 聯系 :: 聚合  :: 管理
              74 Posts :: 0 Stories :: 5 Comments :: 0 Trackbacks

            公告

            文字可能放在http://blog.csdn.net/superlong100,此處存放代碼

            常用鏈接

            留言簿(4)

            我參與的團隊

            搜索

            •  

            最新隨筆

            最新評論

            • 1.?re: Poj 1279
            • 對于一個凹多邊形用叉積計算面積 后能根據結果的正負來判斷給的點集的時針方向?
            • --bsshanghai
            • 2.?re: Poj 3691
            • 你寫的這個get_fail() 好像并是真正的get_fail,也是說fail指向的串并不是當前結點的子串。為什么要這樣弄呢?
            • --acmer1183
            • 3.?re: HDU2295[未登錄]
            • 這個是IDA* 也就是迭代加深@ylfdrib
            • --superlong
            • 4.?re: HDU2295
            • 評論內容較長,點擊標題查看
            • --ylfdrib
            • 5.?re: HOJ 11482
            • 呵呵..把代碼發在這里很不錯..以后我也試試...百度的編輯器太爛了....
            • --csuft1

            閱讀排行榜

            評論排行榜

            Poj上是2286

            #include <stdio.h>
            #include 
            <string.h>

            int map[25], deep;
            char path[101];
            int len; 
            bool flag;
            int f[8][7= {                                               //狀態轉移數組 
                { 13712162123 },
                { 
            24913182224 },
                { 
            111098765 },
                { 
            20191817161514 },
                { 
            24221813942 },
                { 
            23211612731 },
                { 
            14151617181920 },
                { 
            567891011 }
                };

            inline 
            int max(int a, int b)
            {
            return a>b?a:b;}

            void out()                                                       //輸出路徑 
            {
                
            int i;
                
            for(i = 0; i < len; ++ i)
                printf(
            "%c",path[i]);
                puts(
            "");
                printf(
            "%d\n",map[7]);
            }

            inline 
            int cal()                                                 //A* 
            {
                
            int num[4= {0000};
                num[map[
            7]] ++;   num[map[8]] ++;  num[map[9]] ++;
                num[map[
            12]] ++;  num[map[13]] ++;
                num[map[
            16]] ++;   num[map[17]] ++;  num[map[18]] ++;
                
            return 8 - max(max(num[1], num[2]), num[3]);
            }

            inline 
            bool ok()                                                 //判斷是否達到目標態 
            {
                
            int x = map[7], i;
                
            if(map[8]^| map[9]^| map[12]^| map[13]^|
                   map[
            16]^| map[17]^| map[18]^x)
                     
            return false;
                
            return true;
            }

            int astar;

            void dfs(int dep)                                                //IDA*
            {
                
            int temp[25], J;
                
            if(dep == deep) 
                {
                    
            if(ok()) flag = true;
                    
            return ;
                }
                
            for(int i = 0; i < 8++ i)
                {
                    
            for(J = 1; J < 25++ J)temp[J] = map[J];
                                                                             
            //狀態轉移 
                    for(J = 0; J < 6++ J)
                        map[f[i][J]] 
            = temp[f[i][J + 1]];
                    map[f[i][
            6]] = temp[f[i][0]];

                    astar 
            = cal();
                    
            if(deep > dep + astar)
                    {
                        path[len 
            ++= i + 'A';
                        dfs(dep 
            + 1);
                        
            if(flag)return;
                        len 
            --;
                    }
                    
            for(J = 1; J < 25++ J)map[J] = temp[J];
                }
            }

            int main()
            {
                
            while(scanf("%d"&map[1]), map[1])
                {
                    
            for(int i = 2; i < 25++ i) scanf("%d"&map[i]);
                    
            if(ok())
                    {
                        printf(
            "No moves needed\n%d\n", map[7]);
                        
            continue;
                    }
                    len 
            = 0; deep = 1;
                    flag 
            = false;
                    
            while(!flag) 
                    {
                        dfs(
            0);
                        deep 
            ++;
                    }
                    
            out();
                }
            }

            posted on 2009-09-03 01:21 superlong 閱讀(213) 評論(0)  編輯 收藏 引用
            国产99久久久国产精品~~牛| 国产—久久香蕉国产线看观看| 亚洲精品无码久久久久去q| 色欲综合久久中文字幕网| 久久精品亚洲中文字幕无码麻豆 | 青青草原综合久久| 久久久久久久亚洲精品| 久久发布国产伦子伦精品| 狠狠色综合久久久久尤物| 伊人久久大香线蕉亚洲五月天| 久久99热这里只有精品国产| 成人综合伊人五月婷久久| 区亚洲欧美一级久久精品亚洲精品成人网久久久久 | 国产亚州精品女人久久久久久| 国产精品成人久久久| 国产精品久久久天天影视香蕉| 久久午夜无码鲁丝片| 久久亚洲国产成人影院| 大香网伊人久久综合网2020| 国产精品久久久久影院色| 亚洲va久久久噜噜噜久久| 人人狠狠综合久久亚洲| 99久久精品九九亚洲精品| 精品久久一区二区| 国产成年无码久久久久毛片| 99久久精品国产一区二区| 日韩精品久久久久久久电影| 亚洲人AV永久一区二区三区久久| 国产巨作麻豆欧美亚洲综合久久| 日本福利片国产午夜久久| 亚洲国产成人久久综合一| 久久青青草原国产精品免费| 久久久国产精品网站| 国产福利电影一区二区三区久久久久成人精品综合 | 香蕉久久夜色精品国产2020| 久久久精品久久久久久 | 久久久久久毛片免费播放| 久久久久无码精品国产不卡| 久久精品国产亚洲av麻豆色欲| 久久久老熟女一区二区三区| 久久国产精品99久久久久久老狼|