• <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>
            心如止水
            Je n'ai pas le temps
            posts - 400,comments - 130,trackbacks - 0
            #include<cstdio>
            using namespace std;
            const int score[10][10]={{0,0,0,0,0,0,0,0,0,0},
                                     {
            0,6,6,6,6,6,6,6,6,6},
                                     {
            0,6,7,7,7,7,7,7,7,6},
                                     {
            0,6,7,8,8,8,8,8,7,6},
                                     {
            0,6,7,8,9,9,9,8,7,6},
                                     {
            0,6,7,8,9,10,9,8,7,6},
                                     {
            0,6,7,8,9,9,9,8,7,6},
                                     {
            0,6,7,8,8,8,8,8,7,6},
                                     {
            0,6,7,7,7,7,7,7,7,6},
                                     {
            0,6,6,6,6,6,6,6,6,6}};

            int r[10][10],ans(-1),tot(0);
            bool squ[4][4][10],row[10][10],col[10][10];

            void f(int i,int &x,int &y)
            {
                x
            =i/9+1;
                y
            =i%9;
                
            if(i%9==0)
                {
                    x
            --;
                    y
            =9;
                }
            }
            void g(int x,int y,int &xx,int &yy)
            {
                xx
            =x/3;
                
            if(x%3)
                    xx
            ++;
                yy
            =y/3;
                
            if(y%3)
                    yy
            ++;
            }

            void dfs(const int &depth,const int &now)
            {
                tot
            ++;
                
            if(tot>=13000000)
                    
            return;

                
            if(depth<=0)
                {
                    
            if(ans<now)
                        ans
            =now;
                    
            return;
                }

                
            int x,y,xx,yy;
                f(depth,x,y);
                g(x,y,xx,yy);
                
            if(r[x][y])
                    dfs(depth
            -1,now+r[x][y]*score[x][y]);
                
            else
                {
                    
            for(int i=1;i<=9;i++)
                        
            if(!squ[xx][yy][i] && !row[x][i] && !col[y][i])
                        {
                            squ[xx][yy][i]
            =row[x][i]=col[y][i]=true;
                            dfs(depth
            -1,now+i*score[x][y]);
                            squ[xx][yy][i]
            =row[x][i]=col[y][i]=false;
                        }
                }
            }

            int main()
            {
                
            //*
                freopen("data.in","r",stdin);
                freopen(
            "data.out","w",stdout);
                
            //*/

                
            for(int i=1;i<=9;i++)
                    
            for(int j=1;j<=9;j++)
                    {
                        scanf(
            "%d",&r[i][j]);
                        
            int xx,yy;
                        g(i,j,xx,yy);
                        squ[xx][yy][r[i][j]]
            =row[i][r[i][j]]=col[j][r[i][j]]=true;
                    }

                dfs(
            81,0);
                printf(
            "%d\n",ans);

                
            return 0;
            }
            posted on 2011-07-20 20:02 lee1r 閱讀(343) 評論(0)  編輯 收藏 引用 所屬分類: 題目分類:搜索
            精品久久久久久中文字幕| 久久久这里有精品| 久久久久人妻一区二区三区| 久久婷婷人人澡人人爽人人爱| 久久久久国产精品嫩草影院| 人人妻久久人人澡人人爽人人精品| 久久久一本精品99久久精品88 | 久久精品国内一区二区三区| 一本大道久久a久久精品综合| 欧美精品九九99久久在观看| 久久夜色精品国产网站| 欧美久久综合九色综合| 国内精品久久久人妻中文字幕| 天天综合久久一二三区| 激情伊人五月天久久综合| 国产成人香蕉久久久久| 国产欧美一区二区久久| 久久毛片一区二区| 精品久久久无码中文字幕 | 久久精品国产精品亚洲下载| 亚洲AV无码久久精品成人| 久久久SS麻豆欧美国产日韩| 久久精品国产精品亚洲人人| 久久96国产精品久久久| 国产精品无码久久久久久| 一级做a爰片久久毛片免费陪| 欧美精品丝袜久久久中文字幕 | 91精品国产色综合久久| 久久精品国产亚洲AV嫖农村妇女| 久久久99精品成人片中文字幕 | 久久精品国产亚洲精品| 一本伊大人香蕉久久网手机| 996久久国产精品线观看| 人妻少妇久久中文字幕一区二区| 免费久久人人爽人人爽av| 久久综合伊人77777| 伊人热热久久原色播放www| 亚洲人成无码网站久久99热国产| 性做久久久久久免费观看| 伊人久久大香线蕉综合网站| 久久婷婷五月综合国产尤物app|