• <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 閱讀(405) | 評(píng)論 (1)編輯 收藏

            2007年10月24日

            一道基礎(chǔ)題

            12,…,99個(gè)數(shù)分成三組,分別組成三個(gè)三位數(shù),且使這三個(gè)三位數(shù)構(gòu)成

               123的比例,試求出所有滿足條件的三個(gè)三位數(shù)。

               例如:三個(gè)三位數(shù)192,384,576滿足以上條件。
            題目比較基礎(chǔ),自己用的回朔法,萬(wàn)里高樓平地起,慢慢來(lái)吧...
            /* 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) | 評(píng)論 (0)編輯 收藏

            僅列出標(biāo)題  
            <2025年5月>
            27282930123
            45678910
            11121314151617
            18192021222324
            25262728293031
            1234567

            導(dǎo)航

            統(tǒng)計(jì)

            常用鏈接

            留言簿(1)

            隨筆檔案

            搜索

            最新評(píng)論

            閱讀排行榜

            評(píng)論排行榜

            99久久精品国产一区二区三区| 无码国内精品久久人妻麻豆按摩| 中文字幕无码精品亚洲资源网久久| 国产aⅴ激情无码久久| 亚洲精品乱码久久久久66| 久久综合综合久久97色| 亚洲日韩欧美一区久久久久我| 欧美一区二区三区久久综合| 亚洲狠狠综合久久| 狠狠色丁香久久婷婷综合_中| 精品国际久久久久999波多野| 久久精品一区二区影院| 欧美熟妇另类久久久久久不卡| 久久激情亚洲精品无码?V| 乱亲女H秽乱长久久久| 九九久久精品无码专区| 新狼窝色AV性久久久久久| 久久e热在这里只有国产中文精品99| 亚洲中文字幕无码久久2017| 国产精品免费久久久久久久久| 伊人久久大香线蕉亚洲五月天| 久久久久亚洲av毛片大| 99久久综合狠狠综合久久止| 99精品久久久久久久婷婷| 久久伊人中文无码| 精品久久人人做人人爽综合 | 色综合久久天天综线观看| 久久精品午夜一区二区福利| 久久香综合精品久久伊人| 久久久久亚洲精品无码网址 | 久久精品aⅴ无码中文字字幕不卡| 成人午夜精品久久久久久久小说| 精品久久久久久综合日本| 热re99久久6国产精品免费| 亚洲va久久久噜噜噜久久狠狠| 久久精品国产亚洲AV蜜臀色欲 | 国产91久久精品一区二区| 日韩久久久久久中文人妻 | 久久99精品久久久久久久不卡| 麻豆av久久av盛宴av| 久久精品国产色蜜蜜麻豆|