• <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 閱讀(354) 評論(0)  編輯 收藏 引用 所屬分類: 題目分類:搜索
            久久久WWW成人免费毛片| 久久久久亚洲国产| 久久免费高清视频| 久久精品亚洲男人的天堂| 久久人人爽人人人人爽AV | 青青久久精品国产免费看| 久久综合视频网| 久久se精品一区二区| 久久人人爽人人人人爽AV| 99热成人精品免费久久| 久久人人爽人人爽人人片av高请| 91超碰碰碰碰久久久久久综合| 怡红院日本一道日本久久| 亚洲人成电影网站久久| 久久97精品久久久久久久不卡 | 久久99热只有频精品8| 亚洲国产小视频精品久久久三级| 狠狠色丁香久久婷婷综| 欧美喷潮久久久XXXXx| 欧美亚洲国产精品久久久久| 久久久久无码精品| 久久se精品一区二区| 狠狠88综合久久久久综合网| 中文无码久久精品| 久久国产欧美日韩精品| 久久精品国产亚洲AV忘忧草18| 日韩欧美亚洲国产精品字幕久久久| 日本道色综合久久影院| 91精品国产91久久| 99久久精品免费看国产一区二区三区| 人妻精品久久无码区| 久久婷婷激情综合色综合俺也去 | 久久r热这里有精品视频| 久久综合香蕉国产蜜臀AV| 2020久久精品亚洲热综合一本| 久久这里只有精品视频99| 亚洲国产成人精品91久久久 | 狠狠色丁香婷婷久久综合| 青青热久久国产久精品| 久久99九九国产免费看小说| 久久亚洲国产成人影院|