• <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)  編輯 收藏 引用 所屬分類: 題目分類:搜索
            青青草原综合久久| 超级碰碰碰碰97久久久久| 国产精品99久久99久久久| 久久综合噜噜激激的五月天| 久久午夜免费视频| 亚洲精品无码久久久影院相关影片 | 色诱久久久久综合网ywww| 蜜臀av性久久久久蜜臀aⅴ麻豆| 欧美黑人又粗又大久久久| 91久久精品国产91性色也| 久久久免费观成人影院| 99久久免费国产精品热| 偷偷做久久久久网站| 2021少妇久久久久久久久久| 久久人人青草97香蕉| 久久综合九色综合97_久久久| 久久久久亚洲AV无码专区首JN| 91超碰碰碰碰久久久久久综合| 亚洲精品无码专区久久久| 久久精品aⅴ无码中文字字幕不卡| 亚洲国产成人久久精品动漫| 无码人妻少妇久久中文字幕蜜桃 | 久久中文精品无码中文字幕 | 99久久精品日本一区二区免费| 怡红院日本一道日本久久| 精品国产一区二区三区久久久狼 | 无码人妻精品一区二区三区久久 | 99久久做夜夜爱天天做精品| 大蕉久久伊人中文字幕| 久久影院午夜理论片无码| 亚洲欧美另类日本久久国产真实乱对白| 久久er国产精品免费观看8| 最新久久免费视频| 18岁日韩内射颜射午夜久久成人 | 亚洲精品午夜国产va久久| 午夜精品久久久久久99热| 亚洲成人精品久久| 亚洲欧美国产日韩综合久久| 久久精品国产99国产精偷| 久久久久女教师免费一区| 久久精品九九亚洲精品|