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

            comiz

            2007年11月4日

            a problem of maze

            Problem Statement

            People enjoy mazes, but they also get them dirty. Arrows, graffiti, and chewing gum are just a few of the souvenirs people leave on the walls. You, the maze keeper, are assigned to whiten the maze walls. Each face of the wall requires one liter of paint, but you are only required to paint visible faces. You are given a map of the maze, and you must determine the amount of paint needed for the job.

            The maze is described by a vector <string> maze, where each character can be either '#' (a wall) or '.' (an empty space). All '.' characters on the perimeter of the map are considered entrances to the maze. Upon entering the maze, one can only move horizontally and vertically through empty spaces, and areas that are not reachable by these movements are not considered visible. Each '#' represents a square block with four wall faces (each side of the square is a face). A face is visible if it is not directly adjacent to another wall (and is in a reachable area of the maze). For example, two adjacent blocks can have at most six visible faces since two of their faces are directly adjacent to each other. All exterior faces on the perimeter are considered visible.

            For example, the following picture represents a trivial maze with just one (wide) entrance and only four empty reachable spaces:

             TroytownKeeper.png

            To whiten this maze you must paint the faces highlighted in yellow above: 16 for its perimeter, plus 8 interior faces. Note that there are faces that are not visible and thus need not be painted.

            Definition     

            Class: TroytownKeeper

            Method: limeLiters Parameters: vector <string>

            Returns: int

            Method signature: int limeLiters(vector <string> maze)

            (be sure your method is public)     

            Constraints

            - maze will contain between 1 and 50 elements, inclusive.

            - Each element of maze will contain between 1 and 50 characters, inclusive.

            - All elements of maze will have the same number of characters.

            - All characters in maze will be either '.' or '#' . Examples 0)  

             

               

            {"##..#",
            "#.#.#",
            "#.#.#",
            "#####"}
            Returns: 24

            posted @ 2007-11-04 19:35 comiz 閱讀(406) | 評論 (1)編輯 收藏

            2007年10月24日

            一道基礎題

            12,…,99個數分成三組,分別組成三個三位數,且使這三個三位數構成

               123的比例,試求出所有滿足條件的三個三位數。

               例如:三個三位數192,384,576滿足以上條件。
            題目比較基礎,自己用的回朔法,萬里高樓平地起,慢慢來吧...
            /* Note:Your choice is C IDE */
            #define null 0
            #include "stdio.h"
            void inject(int N,int *nNum)
            {
                int sum[3],i,j,k;
                if(N==0)
                {
                    sum[0]=*nNum*100+*(nNum+1)*10+*(nNum+2);
                    sum[1]=*(nNum+3)*100+*(nNum+4)*10+*(nNum+5);
                    sum[2]=*(nNum+6)*100+*(nNum+7)*10+*(nNum+8);
                    if(((sum[0]<<1)==sum[1])&&((3*sum[0])==sum[2]))
                    {
                        printf("we have one of them:");   
                        printf("%d,%d,%d\n",sum[0],sum[1],sum[2]);
                    }
                }
                else
                {
                    for(j=0;j<9;j++)
                    {
                        if(*(nNum+j)==null)
                        {
                            *(nNum+j)=N;
                            inject(N-1,nNum);
                            *(nNum+j)=null;
                        }
                    }
                }
            }
            main()
            {
                int k;
                int Num[9];
                for(k=0;k<9;k++)
                {
                    Num[k]=null;   
                }
                    inject(9,Num);
            }

            posted @ 2007-10-24 18:22 comiz 閱讀(211) | 評論 (0)編輯 收藏

            僅列出標題  
            <2025年5月>
            27282930123
            45678910
            11121314151617
            18192021222324
            25262728293031
            1234567

            導航

            統計

            常用鏈接

            留言簿(1)

            隨筆檔案

            搜索

            最新評論

            閱讀排行榜

            評論排行榜

            日日狠狠久久偷偷色综合免费| 久久99久久99小草精品免视看| 天堂无码久久综合东京热| 无码任你躁久久久久久老妇| 婷婷伊人久久大香线蕉AV | 国产精品热久久毛片| 久久午夜无码鲁丝片午夜精品| 国产色综合久久无码有码| 欧美精品一区二区精品久久| 女同久久| 品成人欧美大片久久国产欧美| 亚洲精品tv久久久久久久久久| 97r久久精品国产99国产精| 久久国产一片免费观看| 欧美一区二区三区久久综合| 91久久成人免费| 精品久久久久久亚洲精品 | 久久精品无码一区二区app| 久久亚洲私人国产精品| 香蕉久久永久视频| 91精品国产高清久久久久久国产嫩草| 综合久久久久久中文字幕亚洲国产国产综合一区首 | 亚洲午夜久久久久久久久久| 久久精品中文字幕一区| 狠狠色丁香婷婷久久综合不卡| 亚洲中文久久精品无码| 亚洲欧美日韩久久精品| 久久综合给合综合久久| 国产精品成人99久久久久 | 国产69精品久久久久777| 国内精品伊人久久久久777| 久久免费大片| 久久久久人妻精品一区三寸蜜桃| 国产精品久久永久免费| 国产精品视频久久久| 久久婷婷五月综合国产尤物app| 久久久久亚洲AV片无码下载蜜桃 | 久久天天躁狠狠躁夜夜躁2O2O | 久久精品成人一区二区三区| 国产巨作麻豆欧美亚洲综合久久| 91性高湖久久久久|